Thanks Thierry,
I knew there had to be a simpler way, but just could not find it
(facet_wrap() does the trick!).
Just 2 other questions:
- How do I remove the plot titles? I don't find any argument in
facet_wrap() on that...
- How can I add the legend for the outliers?
Thanks again,
Ivan
-
Dear Ivan,
You're making things too complicated.
ggplot(mydata, aes(x = Spot, y = Value)) +
geom_boxplot(aes(colour = Equipment), outlier.colour = "red") +
geom_jitter() +
facet_wrap(~Equipment, scales = "free_y") +
scale_colour_manual(values = c(Leeb = "blue", Shore = "red"))
Best regar
Dear useRs,
I have been using base graphics since a long time and I'm currently
trying to switch to ggplot2. I'm struggling with the legend (which
probably means that my graphic commands are not optimal).
I have copied the output from dput(mydata) at the end of the email.
Here is what I have
The problem is that you are not actually 'mapping' any variables to
the fill and colour aestethics so ggplot wont produce legends for
those. I'm not sure ggplots are appropiate for what you're trying to
do here but you can sure hack around it a bit, for instance try:
ggplot(tabu, aes(x=weeks, y=T)
Hi All
Following is my dataset.
dput(tabu)
structure(list(weeks = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
29, 30), values = c(9.45, 7.99, 9.29, 11.66, 12.16, 10.18, 8.04,
11.46, 9.2, 10.34, 9.03, 11.47, 10.51, 9.4, 10.08, 9.37, 10
5 matches
Mail list logo