[R-sig-eco] Axis color change ggplot2

Jonathan Tonkin jdtonkin at gmail.com
Tue Jun 9 12:15:46 CEST 2015


Hi Louis,

Where you have specified "e+  geom_errorbar......" you haven't assigned it
to "e" as you have elsewhere. i.e. "e <- e+  geom_errorbar" (all these e's
are slightly confusing!). So when you change the axis text to blue, you're
assigning it to the version prior to adding the error bars etc.

Hope that makes sense.
Jono

On 3 May 2015 at 18:03, R Erickson <raerickson at gmail.com> wrote:

> Hi,
>
> This question is not ecology specific and you would probably reach more
> ggplot2 experts if you asked your question on the ggplot2 Google Group:
> https://groups.google.com/forum/#!forum/ggplot2
>
> Richard Erickson
>
> On Sat, May 2, 2015 at 8:20 PM, Luis Fernando García <luysgarcia at gmail.com
> >
> wrote:
>
> > Dear R experts,
> >
> > I have a basic question which has turned a headache for me. I want to
> > change the color for the axis value in a plot to blue, but it has been
> > impossible. In the code, I´m using, I plot the mean and Confidence
> > intervals (CI) values for a data summary. I followed one tutorial to
> change
> > this (http://docs.ggplot2.org/0.9.2.1/theme.html) NEvertheless, when I
> > apply the function to change the labels to blue, the axis names and also
> > the CI dissapear. I wanted to know what am I doing wrong.
> >
> > Please find attached the code and the data set!
> >
> > Thanks for any help you can provide!
> >
> >
> > pt
> > http://textuploader.com/x31y
> >
> > bymean <- with(pt, reorder(PREY, -Time, mean))# REordenar por promedio
> >
> > names(a)
> >
> > bymean
> >
> > e <- qplot(bymean, pt$Time,size=3)+theme(panel.grid.major =
> > element_blank(), panel.grid.minor = element_blank(),
> >                                            panel.background =
> > element_blank(), axis.line = element_line(colour = "black"))
> >
> > e<-e+theme(legend.position="none")
> >
> > e + theme(axis.text.x=element_text(colour="black"))
> >
> > e
> >
> > e+  geom_errorbar(data = pt, aes(x = pt$PREY, y = pt$Time, ymin =
> pt$Time -
> > pt$ci, ymax = pt$Time + pt$ci),
> >                   colour = "black", width = 0.4, size=0.5)+
> >   xlab("Prey") +
> >   ylab("Time (UNIDAD?)") +
> >   ggtitle("iMMOBILISATION TIME")
> >
> > e + theme(axis.text = element_text(colour = "blue"))# After making this,
> > the error bars and axis name dissapear.
> >
> >         [[alternative HTML version deleted]]
> >
> > _______________________________________________
> > R-sig-ecology mailing list
> > R-sig-ecology at r-project.org
> > https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>



-- 

*website <http://jdtonkin.github.io>*

*researchgate <https://www.researchgate.net/profile/Jonathan_Tonkin>*
*linkedin* <http://www.linkedin.com/profile/view?id=94466073&trk=tab_pro>
*academia.edu <http://xjtlu.academia.edu/JonathanTonkin>*

*twitter <https://twitter.com/jdtonkin>*

	[[alternative HTML version deleted]]



More information about the R-sig-ecology mailing list