0

I have the following dataset

--------------------------
query   triplestore time
--------------------------
inf.q1  jena    1246
inf.q2  jena    5083
inf.q3  jena    5979
inf.q4  jena    6503
cat.q1  jena    187
cat.q2  jena    13
cat.q3  jena    689
cat.q4  jena    311
int.q1  jena    1110
int.q2  jena    1207
int.q3  jena    500
int.q4  jena    696
occ.q1  jena    1274
order.q1    jena    1508
order.q2    jena    1304
order.q3    jena    1207
sem.q1  jena    4416
sem.q2  jena    3157

And I want to plot for each triplestore a line bar with query in x-axis and time in y-axis.

here is my code

w <- read.csv(file="plot.csv", head=TRUE, sep=",")

p <- ggplot(query, data=w, facets = triplestore ~ ., geom_line(aes(y=time)))

print (p)

but I get the following error

Erreur dans inherits(mapping, "uneval") : objet 'requete' introuvable

Does someone can help ?

Fopa Léon Constantin
  • 11,863
  • 8
  • 48
  • 82
  • Didn't you confuse `ggplot` with `qplot`? `ggplot` does not have such syntax. Check these links for help: [one](http://docs.ggplot2.org/0.9.3/qplot.html), [two](http://docs.ggplot2.org/0.9.3/ggplot.html). – tonytonov Mar 04 '15 at 15:40
  • @tonytonov nope it's ok, however do you have a simple way to do it ? – Fopa Léon Constantin Mar 04 '15 at 15:45
  • How about `ggplot(w, aes(seq_along(query), time)) + geom_line() + facet_wrap(~triplestore) + scale_x_discrete(labels=w$query) + theme(axis.text.x=element_text(angle=-90))` – jan zegan Mar 04 '15 at 16:26
  • @janzegan not excatly because this look like splitting a big line into piece, and the inconvenient is that in each piece we con still see blanck spaces – Fopa Léon Constantin Mar 04 '15 at 16:46

1 Answers1

0

I'm a little confused, but is this what you are looking for? (the jena2 is my addition the show that facetting works)

p <- ggplot(data=w, aes(x=query, y=time)) +
geom_line(aes(group=1)) +
facet_grid(triplestore ~ .)

print (p)

As tonytonov pointed out, the syntax for ggplot is different! enter image description here

RHA
  • 3,677
  • 4
  • 25
  • 48
  • Great ! you have the point. Any idea on how to ajust the y-axis values in each plot around the maximum value ? – Fopa Léon Constantin Mar 04 '15 at 17:03
  • Yes, see here [link](http://stackoverflow.com/questions/27299425/change-y-axis-limits-for-each-row-of-a-facet-plot-in-ggplot2) – RHA Mar 04 '15 at 20:46