Re: [R] ggplot - boxplot and points split by two factors

2014-09-08 Thread Federico Lasa
Use geom_jitter() instead of geom_point

On Mon, Sep 8, 2014 at 12:37 PM, Tom Wright  wrote:
> ggplot(data,aes(x = z1, y = x, fill=x2)) +
>   geom_boxplot() +
>   geom_point(alpha=0.5,
> position=position_jitterdodge(jitter.width=0.1),
> aes(group=x2))
>
> On Mon, 2014-09-08 at 13:10 -0400, Tom Wright wrote:
>> Hi,
>> I'm trying to create a boxplot overlayed with points where the data is
>> split by two factor groups.
>> So far:
>>
>> x1<-factor(rep(LETTERS[1:4],5))
>> x2<-factor(rep(letters[1:2],10))
>> z<-runif(20,0,10)
>>
>> data<-data.frame(x1=x1,x2=x2,z=z)
>>
>> ggplot(data,aes(x=x1,y=z,fill=x2)) +
>>   geom_boxplot() +
>>   geom_point()
>>
>>
>> Obviously I'd also like to separate the points to overlay the relevant 
>> boxplots.
>>
>> Any hints gratefully received.
>> Thanks,
>> Tom
>>
>
> __
> R-help@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.

__
R-help@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.


Re: [R] ggplot - boxplot and points split by two factors

2014-09-08 Thread Tom Wright
ggplot(data,aes(x = z1, y = x, fill=x2)) +
  geom_boxplot() +
  geom_point(alpha=0.5,
position=position_jitterdodge(jitter.width=0.1),
aes(group=x2))

On Mon, 2014-09-08 at 13:10 -0400, Tom Wright wrote:
> Hi,
> I'm trying to create a boxplot overlayed with points where the data is
> split by two factor groups.
> So far:
> 
> x1<-factor(rep(LETTERS[1:4],5))
> x2<-factor(rep(letters[1:2],10))
> z<-runif(20,0,10)
> 
> data<-data.frame(x1=x1,x2=x2,z=z)
> 
> ggplot(data,aes(x=x1,y=z,fill=x2)) +
>   geom_boxplot() +
>   geom_point()
> 
> 
> Obviously I'd also like to separate the points to overlay the relevant 
> boxplots.
> 
> Any hints gratefully received.
> Thanks,
> Tom
>

__
R-help@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.


[R] ggplot - boxplot and points split by two factors

2014-09-08 Thread Tom Wright
Hi,
I'm trying to create a boxplot overlayed with points where the data is
split by two factor groups.
So far:

x1<-factor(rep(LETTERS[1:4],5))
x2<-factor(rep(letters[1:2],10))
z<-runif(20,0,10)

data<-data.frame(x1=x1,x2=x2,z=z)

ggplot(data,aes(x=x1,y=z,fill=x2)) +
geom_boxplot() +
geom_point()


Obviously I'd also like to separate the points to overlay the relevant boxplots.

Any hints gratefully received.
Thanks,
Tom

__
R-help@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.


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

2013-01-24 Thread arun
HI,
You can get the plot in the same window, but the width seems to be a problem.
stest<- read.table(text="
    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 
",sep="",header=T,stringsAsFactors=T)
stest1<-stest
 stest1<- within(stest1,{year<- factor(year)})
ggplot(stest1, aes(x=year, y=conc)) + geom_boxplot(horizontal=TRUE)+
 facet_wrap(~ site, ncol = 1, scales="free_x") + 
coord_flip()+scale_y_log10()+
  theme_bw() + opts(strip.text.x = theme_text())
A.K.





- Original Message -
From: Niec 
To: r-help@r-project.org
Cc: 
Sent: Thursday, January 24, 2013 1:13 PM
Subject: Re: [R] How to drop unused factors in faceted R ggplot boxplot?

Thank you, Jeff. I think I should have been more clear.  I don't want to
modify my data. I need to create a series of box plots for different sites
(north and south in my example but there are many more) but I don't want
empty rows in my plot - for years when data was not collected. I tried to
make separate plots and join them with grid.arrange and it plots the layout
I want but I can't get the boxes in all plots have uniform look (width), see
the screenshot:
<http://r.789695.n4.nabble.com/file/n4656535/2013-01-24_0949.png> 

And thank you for pointing out the shortcomings of my posted data sample.
I'll be better prepared next time.



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

__
R-help@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.


__
R-help@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.


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

2013-01-24 Thread Gorczynski, George
Hi and thanks. This unfortunately doesn't work because:
"ggplot2 does not currently support free scales with a non-cartesian coord or 
coord_flip."

-Original Message-
From: arun [mailto:smartpink...@yahoo.com] 
Sent: January-24-13 1:49 PM
To: Gorczynski, George
Cc: R help
Subject: Re: [R] How to drop unused factors in faceted R ggplot boxplot?

HI,
You can get the plot in the same window, but the width seems to be a problem.
stest<- read.table(text="
    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
",sep="",header=T,stringsAsFactors=T)
stest1<-stest
 stest1<- within(stest1,{year<- factor(year)}) ggplot(stest1, aes(x=year, 
y=conc)) + geom_boxplot(horizontal=TRUE)+
 facet_wrap(~ site, ncol = 1, scales="free_x") + 
coord_flip()+scale_y_log10()+
  theme_bw() + opts(strip.text.x = theme_text()) A.K.





- Original Message -
From: Niec 
To: r-help@r-project.org
Cc: 
Sent: Thursday, January 24, 2013 1:13 PM
Subject: Re: [R] How to drop unused factors in faceted R ggplot boxplot?

Thank you, Jeff. I think I should have been more clear.  I don't want to
modify my data. I need to create a series of box plots for different sites
(north and south in my example but there are many more) but I don't want
empty rows in my plot - for years when data was not collected. I tried to
make separate plots and join them with grid.arrange and it plots the layout
I want but I can't get the boxes in all plots have uniform look (width), see
the screenshot:
<http://r.789695.n4.nabble.com/file/n4656535/2013-01-24_0949.png> 

And thank you for pointing out the shortcomings of my posted data sample.
I'll be better prepared next time.



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

__
R-help@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.

__
R-help@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.


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

2013-01-24 Thread Niec
Thank you, Jeff. I think I should have been more clear.  I don't want to
modify my data. I need to create a series of box plots for different sites
(north and south in my example but there are many more) but I don't want
empty rows in my plot - for years when data was not collected. I tried to
make separate plots and join them with grid.arrange and it plots the layout
I want but I can't get the boxes in all plots have uniform look (width), see
the screenshot:
<http://r.789695.n4.nabble.com/file/n4656535/2013-01-24_0949.png> 

And thank you for pointing out the shortcomings of my posted data sample.
I'll be better prepared next time.



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

__
R-help@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.


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

2013-01-23 Thread Jeff Newmiller
Your example is not reproducible. [1]

Usually we use subset() or vector/array indexing when we want to work with part 
of the data. Apparently you want to exclude rows that specify "north" for which 
the year does not have a corresponding row with the same year and specifies 
"south".

southidxs <- with( test, "south" == site )
southyears <- unique( test$year[southidxs] )
subset( test, !("north"==site & !year %in% southyears ))

(untested)

[1] 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

Niec  wrote:

>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   yearconc
>south  20015.3
>south  20014.67
>south  20014.98
>south  20025.76
>south  20025.93
>north  20014.64
>north  20016.32
>north  200311.5
>north  20036.3
>north  20049.6
>north  200456.11
>north  200463.55
>north  200461.35
>north  200567.11
>north  200639.17
>north  200643.51
>north  200676.21
>north  2006158.89
>north  2006122.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.
>
>__
>R-help@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.

__
R-help@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.


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

2013-01-23 Thread Niec
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()


siteyearconc
south   20015.3
south   20014.67
south   20014.98
south   20025.76
south   20025.93
north   20014.64
north   20016.32
north   200311.5
north   20036.3
north   20049.6
north   200456.11
north   200463.55
north   200461.35
north   200567.11
north   200639.17
north   200643.51
north   200676.21
north   2006158.89
north   2006122.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.

__
R-help@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.


Re: [R] ggplot boxplot

2011-01-20 Thread Dennis Murphy
Hi:

See inline, please.

On Thu, Jan 20, 2011 at 4:22 PM, Nathan Miller wrote:

> Hello,
>
> I am trying to generate a set of boxplots using ggplot with the following
> data with 4 columns (Day, Site, VO2, Cruise)
>
>  AllCorbulaMR
>Day Site  VO2 Cruise
> 1 11 148.43632670  1
> 2 11  61.73864969  1
> 3 11  92.64536096  1
> 4 11  73.35434957  1
> 5 11  69.85568810  1
> 6 11  98.71116866  1
> 7 11  67.57880107  1
> 8 11  80.57959160  1
> 9 11  53.38577137  1
> 1012  81.08429594  1
> 1112  79.73019687  1
> 1212  67.93991806  1
> 1312  50.69929558  1
> 1412  42.02457680  1
> 1512  64.10049924  1
> 1612  80.02264095  1
> 1712  67.14828804  1
> 1812  93.33363743  1
> 1913  53.86021985  1
> 2013  50.53366868  1
> 2113  52.12437086  1
> 2213  43.44618922  1
> 2313  64.64322840  1
> 2413  55.03761768  1
> 2513  67.79501374  1
> 2614  12.70806068  1
> 2714 114.56401960  1
> 2814  34.34450695  1
> 2914  76.70849935  1
> 3014  68.99752863  1
> 3114  71.23080332  1
> 3211   0.08222308  2
> 3311   NA  2
> 3411   0.03743258  2
> 3511   0.04496363  2
> 3611   0.07184903  2
> 3711   0.05637676  2
> 3811   0.05163886  2
> 3911   0.03022606  2
> 4011   0.04150667  2
> 4121   0.04982530  2
> 4221   0.05248479  2
> 4321   0.03839707  2
> 4421   0.04283591  2
> 4521   0.03285247  2
> 4621   0.03965853  2
> 4721   NA  2
> 4821   0.03637822  2
> 4921   0.03686663  2
> 5012   0.04086229  2
> 5112   NA  2
> 5212   0.01891389  2
> 5312   0.03365864  2
> 5412   0.04179611  2
> 5512   0.04675111  2
> 5612   0.04734616  2
> 5712   0.04046907  2
> 5812   0.03395499  2
> 5922   0.02104620  2
> 6022   NA  2
> 6122   NA  2
> 6222   NA  2
> 6322   0.01882796  2
> 6422   NA  2
> 6522   NA  2
> 6622   0.02328894  2
> 6722   0.02635327  2
> 6813   0.06030056  2
> 6913   0.0472  2
> 7013   0.04307900  2
> 7113   0.05144241  2
> 7213   0.03223973  2
> 7313   0.05145292  2
> 7413   0.02718536  2
> 7513   0.02830348  2
> 7613   0.05859836  2
> 7723   0.04521778  2
> 7823   0.03242385  2
> 7923   0.03412688  2
> 8023   0.04407171  2
> 8123   0.04517834  2
> 8223   NA  2
> 8323   0.02745407  2
> 8423   0.03118602  2
> 8523   0.04420074  2
> 8614   0.05352334  2
> 8714   0.05378120  2
> 8814   0.04394838  2
> 8914   0.02597939  2
> 9014   0.05476946  2
> 9114   0.04371743  2
> 9224   0.04022729  2
> 9324   0.04078509  2
> 9424   0.04911994  2
> 9524   0.04068468  2
> 9624   NA  2
> 9724   NA  2
> 9811   0.08892223  3
> 9911   0.08617873  3
> 100   11   0.06108950  3
> 101   11   0.19047922  3
> 102   11   0.09865930  3
> 103   11   0.12103549  3
> 104   11   0.06788404  3
> 105   11   0.12629497  3
> 106   11   0.10947173  3
> 107   11   0.11381467  3
> 108   21   0.07809781  3
> 109   21   0.04397586  3
> 110   21   0.06317635  3
> 111   21   0.02020365  3
> 112   21   0.09525985  3
> 113   21   0.04732347  3
> 114   21   0.03043341  3
> 115   21   0.04419395  3
> 116   21   NA  3
> 117   21   NA  3
> 118   12   0.03380003  3
> 119   12   0.02600926  3
> 120   12   0.03980552  3
> 121   12   0.03659985  3
> 122   12   0.04867881  3
> 123   12   0.03694679  3
> 124   12   0.03372825  3
> 125   12   0.03644750  3
> 126   12   0.01497611  3
> 127   12   0.02697976  3
> 128   22   0.03136923  3
> 129   22   0.03602215  3
> 130   22   0.04000660  3
> 131   22   0.03673098  3
> 132   22   0.03090854  3
> 133   22   0.04877643  3
> 134   22   0.02468537  3
> 135   22   NA  3
> 136  

[R] ggplot boxplot

2011-01-20 Thread Nathan Miller
Hello,

I am trying to generate a set of boxplots using ggplot with the following
data with 4 columns (Day, Site, VO2, Cruise)

 AllCorbulaMR
Day Site  VO2 Cruise
1 11 148.43632670  1
2 11  61.73864969  1
3 11  92.64536096  1
4 11  73.35434957  1
5 11  69.85568810  1
6 11  98.71116866  1
7 11  67.57880107  1
8 11  80.57959160  1
9 11  53.38577137  1
1012  81.08429594  1
1112  79.73019687  1
1212  67.93991806  1
1312  50.69929558  1
1412  42.02457680  1
1512  64.10049924  1
1612  80.02264095  1
1712  67.14828804  1
1812  93.33363743  1
1913  53.86021985  1
2013  50.53366868  1
2113  52.12437086  1
2213  43.44618922  1
2313  64.64322840  1
2413  55.03761768  1
2513  67.79501374  1
2614  12.70806068  1
2714 114.56401960  1
2814  34.34450695  1
2914  76.70849935  1
3014  68.99752863  1
3114  71.23080332  1
3211   0.08222308  2
3311   NA  2
3411   0.03743258  2
3511   0.04496363  2
3611   0.07184903  2
3711   0.05637676  2
3811   0.05163886  2
3911   0.03022606  2
4011   0.04150667  2
4121   0.04982530  2
4221   0.05248479  2
4321   0.03839707  2
4421   0.04283591  2
4521   0.03285247  2
4621   0.03965853  2
4721   NA  2
4821   0.03637822  2
4921   0.03686663  2
5012   0.04086229  2
5112   NA  2
5212   0.01891389  2
5312   0.03365864  2
5412   0.04179611  2
5512   0.04675111  2
5612   0.04734616  2
5712   0.04046907  2
5812   0.03395499  2
5922   0.02104620  2
6022   NA  2
6122   NA  2
6222   NA  2
6322   0.01882796  2
6422   NA  2
6522   NA  2
6622   0.02328894  2
6722   0.02635327  2
6813   0.06030056  2
6913   0.0472  2
7013   0.04307900  2
7113   0.05144241  2
7213   0.03223973  2
7313   0.05145292  2
7413   0.02718536  2
7513   0.02830348  2
7613   0.05859836  2
7723   0.04521778  2
7823   0.03242385  2
7923   0.03412688  2
8023   0.04407171  2
8123   0.04517834  2
8223   NA  2
8323   0.02745407  2
8423   0.03118602  2
8523   0.04420074  2
8614   0.05352334  2
8714   0.05378120  2
8814   0.04394838  2
8914   0.02597939  2
9014   0.05476946  2
9114   0.04371743  2
9224   0.04022729  2
9324   0.04078509  2
9424   0.04911994  2
9524   0.04068468  2
9624   NA  2
9724   NA  2
9811   0.08892223  3
9911   0.08617873  3
100   11   0.06108950  3
101   11   0.19047922  3
102   11   0.09865930  3
103   11   0.12103549  3
104   11   0.06788404  3
105   11   0.12629497  3
106   11   0.10947173  3
107   11   0.11381467  3
108   21   0.07809781  3
109   21   0.04397586  3
110   21   0.06317635  3
111   21   0.02020365  3
112   21   0.09525985  3
113   21   0.04732347  3
114   21   0.03043341  3
115   21   0.04419395  3
116   21   NA  3
117   21   NA  3
118   12   0.03380003  3
119   12   0.02600926  3
120   12   0.03980552  3
121   12   0.03659985  3
122   12   0.04867881  3
123   12   0.03694679  3
124   12   0.03372825  3
125   12   0.03644750  3
126   12   0.01497611  3
127   12   0.02697976  3
128   22   0.03136923  3
129   22   0.03602215  3
130   22   0.04000660  3
131   22   0.03673098  3
132   22   0.03090854  3
133   22   0.04877643  3
134   22   0.02468537  3
135   22   NA  3
136   22   NA  3
137   22   NA  3
138   13   0.04809866  3
139   13   0.02380070  3
140   13   0.03672271  3
141   13   0.03232115  3
142   13   0.02950701  3
143   13   0.05068163  3
144   13   0.03004234  3
145   13   0.03090461  3
146   13   0.04539888  3
147   

Re: [R] ggplot boxplot - how to order categories

2008-08-25 Thread Raj Minhas

Hadley,

Many thanks - I have just started using ggplot and it is an amazing package. 

-Raj.
-- 
View this message in context: 
http://www.nabble.com/ggplot-boxplot---how-to-order-categories-tp19147920p19148953.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] ggplot boxplot - how to order categories

2008-08-25 Thread hadley wickham
Hi Raj,

It's the same as the other plotting systems in R: you need to change
the order of the underlying factor levels.  e.g.:

levels(diamonds$color) <- c("J", "D", "E", "I", "H", "F", "G")

If you're reordering then according to the value of another variable,
also see ?reorder

Hadley

On Mon, Aug 25, 2008 at 12:56 PM, Raj Minhas <[EMAIL PROTECTED]> wrote:
>
> I am interested in creating a boxplot using ggplot or qplot where I can
> specify the order of the categories being plotted on the x-axis. For
> example, the following command plots the categories (diamond color) in
> alphabetic order (D, E, ..., J):
>
> qplot(color, price/carat, data=diamonds, geom="boxplot")
>
> I want to know how I can modify this command so that the categories are
> plotted in a different order (say, J, D, E, I, H, F, G).
>
> Thanks in advance.
>
> -Raj.
> --
> View this message in context: 
> http://www.nabble.com/ggplot-boxplot---how-to-order-categories-tp19147920p19147920.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> R-help@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.
>



-- 
http://had.co.nz/

__
R-help@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.


[R] ggplot boxplot - how to order categories

2008-08-25 Thread Raj Minhas

I am interested in creating a boxplot using ggplot or qplot where I can
specify the order of the categories being plotted on the x-axis. For
example, the following command plots the categories (diamond color) in
alphabetic order (D, E, ..., J):

qplot(color, price/carat, data=diamonds, geom="boxplot")

I want to know how I can modify this command so that the categories are
plotted in a different order (say, J, D, E, I, H, F, G).

Thanks in advance.

-Raj.
-- 
View this message in context: 
http://www.nabble.com/ggplot-boxplot---how-to-order-categories-tp19147920p19147920.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.