[R] Add axis name to x-axis ggplot

Joshua Wiley jwiley.psych at gmail.com
Sun Jul 17 09:44:07 CEST 2011


Hi,

On Sat, Jul 16, 2011 at 10:19 PM, hrishi <hrishi27n at gmail.com> wrote:
> Hello,
>
> I have plotted a ggplot, the image is attached below.
> Now I have two questions:
>
> 1. How to order the pvalue displayed in the plot.
> I want the pvalue in the order : 0 to 1E-12, 1E-12 to 1E-6, 1E-6 to 1E-3,
> 1E-3 to 0.05 and finally 0.05

Easy, order the factor as you want it displayed.  See ?factor

>
> 2. Add name to the X-axis.
> I wanted to add a label to the X-axis

Please do try searching or reading basic documentation before emailing
the list.  Here is a good place to start:

http://had.co.nz/ggplot2/

Hadley also has a good book on using ggplot2 that would be quite
instructive.  Finally, note that ggplot2 has a dedicated mailing list
on google that is a better place to post than R-help for ggplot2
specific questions.

There are several ways to accomplish what you want.  You show an
image, but have provided no reproducible example nor code.  From your
example image, I am guessing you have somehow supressed the default
axis labels and tick marks, but without any indication of how you
created the plot, it is difficult to provide a simple, "do this".

Cheers,

Josh

>
> http://r.789695.n4.nabble.com/file/n3672938/1A2.jpeg I have removed the
> labels and ticks before.
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Add-axis-name-to-x-axis-ggplot-tp3672938p3672938.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.
>



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
https://joshuawiley.com/



More information about the R-help mailing list