Hello C.H.

I've also been curious about this plot a while ago.
Your question today inspired me to collect all that I've came by in one
post, and I published it here:

http://www.r-statistics.com/2011/03/scatter-dot-beeswarm-box-violin-plot-and-plotting-it-with-r/

I hope it might help you or others in the future.

Best,
Tal

<http://www.r-statistics.com/2011/03/scatter-dot-beeswarm-box-violin-plot-and-plotting-it-with-r/>

----------------Contact
Details:-------------------------------------------------------
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
----------------------------------------------------------------------------------------------




On Wed, Mar 9, 2011 at 9:27 AM, Jim Lemon <j...@bitwrit.com.au> wrote:

> On 03/08/2011 11:27 PM, C.H. wrote:
>
>> Dear R Users,
>>
>> I would like to know is there any package to create a plot like this?
>>
>> http://dl.dropbox.com/u/5409929/cs1160521f01.gif
>>
>> X axis is categorical. And the positions of the points are
>> corresponding to the frequency. (similar to violinplot)
>>
>>  Hi CH,
> This looks like it uses the same method as in the function brkdn.plot in
> the plotrix package. What this does is to offset each value in a particular
> stack by a small amount to the right, then twice that amount to the left,
> then three times that amount to the right, and so on. This would spread your
> data points out for each bin of values. The plot looks as though the data
> points in each bin are sorted before spreading, so that the "branches" in
> each bin slant upward. Let's see:
>
> x<-list(runif(90),runif(100),runif(80))
>
> dendroPlot<-function(x,breaks=NA,nudge=NA) {
>  if(is.na(breaks[1]))
>  breaks=seq(min(unlist(x),na.rm=TRUE),
>  max(unlist(x),na.rm=TRUE),length.out=10)
>  plot(c(0,length(x)+1),range(unlist(x)),type="n")
>  if(is.na(nudge)) nudge<-strwidth("o")/2
>  for(list_element in 1:length(x)) {
>  binvar<-cut(x[[list_element]],breaks=breaks)
>  for(bin in 1:length(levels(binvar))) {
>   thisbin<-which(as.numeric(binvar)==bin)
>   offset<-(1:length(x[[list_element]][thisbin])-1)*nudge
>   offset[seq(2,length(offset),by=2)]<-
>    -offset[seq(2,length(offset),by=2)]
>   points(list_element+offset,sort(x[[list_element]][thisbin]))
>  }
>  }
> }
>
> dendroPlot(x)
>
> I think this might make it into plotrix. Let me know if it does what you
> want.
>
> Jim
>
>
> ______________________________________________
> 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.
>

        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to