[R] dot plot with several points for 2 categories

jaregi suckale at mpi-cbg.de
Wed Jul 29 18:11:59 CEST 2009


Hi Michael, Steve, and 1Rnwb,

I'm very impressed by the quick replies on the mailer. Thanks a lot for your
suggestions. They worked very well. 

In general, I have to say that I'm a bit disappointed that in R, like in
Excel, one basically needs to hack to get a dot blot with categories by
adding an artificial x value. I was hoping this common type of diagram could
be generated using a standard function like dotplot or dotchart.

Best, j



Michael Knudsen-2 wrote:
> 
> On Fri, Jul 17, 2009 at 7:17 PM, jaregi<suckale at mpi-cbg.de> wrote:
> 
>> I'm trying to wean myself off the very limited capabilities of Excel and
>> Oo.
>> Currently, I am trying to make a plot showing several values for 2
>> categories in a dot blot (see
>> http://www.nabble.com/file/p24538360/Picture%2B1.png Picture+1.png
>>  except
>> that the x axis should contain the category not a number, which was the
>> only
>> way to coax Excel into displaying a plot like this).
> 
> Let y1 be a vector containing the values in the first category, and
> let y2 contain those of the second. The you could do like this:
> 
> x1 = rep(1,times=length(y1))
> x2 = rep(2,times=length(y2))
> plot(c(x1,x2),c(y1,y2),xaxt="n")
> axis(side=1,at=c(1,2),labels=c("label1","label2"))
> 
> It looks like a hack, but it should work.
> 
> -- 
> Michael Knudsen
> micknudsen at gmail.com
> http://lifeofknudsen.blogspot.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.
> 
> 

-- 
View this message in context: http://www.nabble.com/dot-plot-with-several-points-for-2-categories-tp24538360p24722548.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list