[R] How to drop unused factors in faceted R ggplot boxplot?

Niec ggorczynski at golder.com
Thu Jan 24 06:44:02 CET 2013


Below is the data sample(example) that I use to make boxplots. I tried
everything I could think of but cannot make a plot where for the south site
only years existing in data for this site show. Is what I am trying to do
possible? Thank you. Here is my code:

    ggplot(stest, aes(x=year, y=conc)) +
      geom_boxplot(horizontal=TRUE) +
      facet_wrap(~site , ncol=1) +coord_flip() + scale_y_log10()


    site	year	conc
    south	2001	5.3
    south	2001	4.67
    south	2001	4.98
    south	2002	5.76
    south	2002	5.93
    north	2001	4.64
    north	2001	6.32
    north	2003	11.5
    north	2003	6.3
    north	2004	9.6
    north	2004	56.11
    north	2004	63.55
    north	2004	61.35
    north	2005	67.11
    north	2006	39.17
    north	2006	43.51
    north	2006	76.21
    north	2006	158.89
    north	2006	122.27

<http://r.789695.n4.nabble.com/file/n4656480/2013-01-23_2130.png> 





--
View this message in context: http://r.789695.n4.nabble.com/How-to-drop-unused-factors-in-faceted-R-ggplot-boxplot-tp4656480.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list