Skip to content

geom_boxplot

4 messages · Li Li, John Kane, PIKAL Petr

#
Yes you can do all of the things you want.  

Below is a start, to give you an idea of how to approach some of it.
====================================================
library(ggplot2)
p <- ggplot(mtcars, aes(factor(cyl), mpg))
 p  <-  p + geom_boxplot(aes(fill = factor(cyl))) +
      labs(fill = "Cylinders")  +
      scale_y_continuous("Miles per Gallon") +
      scale_x_discrete("Number of Cylinders")
p

============================================================
Have a look at ackoverflow.com/questions/3606697/how-to-set-x-axis-limits-in-ggplot2-r-plots for x and y axes limits.  

It took me a while to realise it but, generally, I find that it is not too hard to find examples of what you need by just googling something like :ggplot2 set x and y limits  or ggplot2 geom_bar colour and so on.   

The ggplot2 and geom_XXX are pretty unique on the internet and search results usually are not too bad.  

You may also want to subcribe to the ggplot2 group on google groups.

Best wishes


John Kane
Kingston ON Canada
____________________________________________________________
FREE ONLINE PHOTOSHARING - Share your photos online with your friends and family!
Visit http://www.inbox.com/photosharing to find out more!
#
Hi

In new ggplot2 version following works too

p + geom_boxplot(aes(fill = factor(cyl))) +
       labs(fill = "Cylinders") + ylab("Miles per Gallon")+xlab("Number of 
Cylinders")

Regards
Petr
ackoverflow.com/questions/3606697/how-to-set-x-axis-limits-
too
and family!
http://www.R-project.org/posting-guide.html
#
Thanks Petr,

I suppose this means I have to reread that set of changes again.  I think I noticed it and promptly forgot it.

John Kane
Kingston ON Canada
____________________________________________________________
FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!