[R] Strange tick in ggplot geom_area; and ordering, again

Dieter Menne dieter.menne at menne-biomed.de
Tue Jan 26 17:05:23 CET 2010


In the area plots below, I see 4 triangle ticks at both sides of the bar; I
believe these are non-stacked values for p, but they are definitively
confusing.

In addition, I would like to get the order of the colors in the plot the
same as in the legend, and not arranged alphabetically (the factor is
ordered, don't touch my order). Hadley once mentioned an undocumented
aestetics "order", but I could not get it to work in the example.

Dieter


library(ggplot2)
cf1 = structure(list(dur = c(10L, 10L, 10L, 10L, 10L, 150L, 150L,
150L, 150L, 150L), score = structure(c(3L, 1L, 4L, 5L, 2L, 3L,
1L, 4L, 5L, 2L), .Label = c("none", "weak", "moderate", "severe",
"verysevere"), class = c("ordered", "factor")), p = c(0.04, 0.02,
0.26, 0.6, 0.07, 0.07, 0.05, 0.33, 0.42, 0.14)), .Names = c("dur",
"score", "p"), class = c("cast_df", "data.frame"))

# columns do not ad to 100% because of rounding; never mind

qplot(dur,p,data=cf1, fill=score)+  geom_area()


-- 
View this message in context: http://n4.nabble.com/Strange-tick-in-ggplot-geom-area-and-ordering-again-tp1294692p1294692.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list