Ordering of any discrete values in ggplot goes according to the levels of the
factor. As a convenience, ggplot will convert character values into factor for
you according to the default order alphabetical). To take control of this you
have to convert your discrete columns to factors yourself before giving the data
to ggplot, e.g.
DF$somecol <- factor( DF$somecol,
levels=c("level1","level2",...) )
However, if you pull data from different factors in different input tables,
ggplot has to combine them internally, and you will lose your specified
ordering. With no minimum reproducible example I cannot tell whether that is a
problem for you, but the solution would be to combine them yourself before you
give them to ggplot.
--
Sent from my phone. Please excuse my brevity.
On May 1, 2016 4:59:23 PM PDT, Judson Blake <parsifalblake at gmail.com>
wrote:>Using geom_errorbarh with ggplot, my plot has several error bars. For
>my
>presentation, the order of these bars from top to bottom is important.
>But errorbarh seems to put these in a random order I can't change. (
>It
>does not follow the order in the data.frame. ) How can I specify the
>order of the bars? Could I also specify the thickness of the bar
>lines?
>
> [[alternative HTML version deleted]]
>
>______________________________________________
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>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.
[[alternative HTML version deleted]]