[R] Strange tick in ggplot geom_area; and ordering, again
hadley wickham
h.wickham at gmail.com
Tue Jan 26 17:15:40 CET 2010
Hi Dieter,
It looks like a bug:
Order works fine with bars:
qplot(factor(dur),weight=p,data=cf1, fill=score, geom = "bar", order =
rev(score))
but not with areas:
qplot(dur, p, data=cf1, fill=score, geom = "area", order = rev(score))
I'll add it to my to do list.
Hadley
On Tue, Jan 26, 2010 at 10:05 AM, Dieter Menne
<dieter.menne at menne-biomed.de> wrote:
>
> 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.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
--
http://had.co.nz/
More information about the R-help
mailing list