[R] Frequency plot --- stacked symbols

Eik Vettorazzi E.Vettorazzi at uke.uni-hamburg.de
Tue Feb 8 20:29:48 CET 2011


Hi,
either upscale the circles (increase cex) or narrow your plot, as in
x11(3,5)
stripchart(x,method="stack",pch=21,at=0,bg="lightblue",col="blue",offset=.5,cex=1.5,xlab="Bag
B",frame.plot=FALSE,axes=FALSE)

there's a trade off between 'closing the gap' and having all your ticks
readable, so just play around. Additionally you can rescale your tick marks:

axis(1,at=seq(2,18,by=2),cex.axis=.8)


hth.

Am 08.02.2011 20:12, schrieb David Arnold:
> Hi,
> 
> This was a terrific suggestion. I'm no expert in R, but I managed to find and read the axis command to do the following.
> 
> x=c(rep(2,14),rep(4,13),rep(6,11),rep(8,4),rep(10,3),rep(12,2),14,16,18)
> 
> stripchart(x,method="stack",pch=21,at=0,bg="lightblue",col="blue",offset=.5,cex=1.5,xlab="Bag B",frame.plot=FALSE,axes=FALSE)
> 
> axis(1,at=seq(2,18,by=2))
> 
> This produced the following graph when saved to a pdf file:
> 
> http://msemac.redwoods.edu/~darnold/math15/LizPlot.pdf
> 
> However, there is a huge block of whitespace above the stacked circles that I would like to get rid of so it doesn't take up space in my Latex document. How can I do that?
> 
> David.
> 
> On Feb 8, 2011, at 2:57 AM, Eik Vettorazzi wrote:
> 
>> Hi David,
>> you can use base 'stripchart'
>>
>> stripchart(rbinom(100,size=10,p=.3),method="stack",pch=21,at=0,bg="lightblue",col="blue",offset=.5,cex=1.5,xlim=c(0,10))
>>
>> and set 'pch' as you wish, e.g. as in
>>
>> example(points)
>>
>> hth.
>>
>> Am 08.02.2011 08:27, schrieb David Arnold:
>>> Hi,
>>>
>>> We were wondering how we could make a stacked frequency diagram such as this one:
>>>
>>> http://msemac.redwoods.edu/~darnold/math15/liz.pdf
>>>
>>> We don't necessarily need the shaded "balls", other characters would be fine, such as stacks of x's.
>>>
>>> David
>>> ______________________________________________
>>> 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.
>>
>>
>> -- 
>> Eik Vettorazzi
>> Institut für Medizinische Biometrie und Epidemiologie
>> Universitätsklinikum Hamburg-Eppendorf
>>
>> Martinistr. 52
>> 20246 Hamburg
>>
>> T ++49/40/7410-58243
>> F ++49/40/7410-57790
> 


-- 
Eik Vettorazzi
Institut für Medizinische Biometrie und Epidemiologie
Universitätsklinikum Hamburg-Eppendorf

Martinistr. 52
20246 Hamburg

T ++49/40/7410-58243
F ++49/40/7410-57790



More information about the R-help mailing list