[R] axis placement with stacked barplots and the asp=1 parameter

Uwe Ligges ligges at statistik.uni-dortmund.de
Fri Jan 21 15:47:16 CET 2005


Kavithan Siva wrote:

> Hi
> 
> Here's some example code which illustrates the issue:
> 
> dataSeries<-array(0, c(5, 2))
> 
> dataSeries[1, 1] <- 5
> dataSeries[2, 1] <- 5
> dataSeries[3, 1] <- 0
> dataSeries[4, 1] <- 2
> dataSeries[5, 1] <- 0
> 
> dataSeries[1, 2] <- 7
> dataSeries[2, 2] <- 0
> dataSeries[3, 2] <- 0
> dataSeries[4, 2] <- 0
> dataSeries[5, 2] <- 1
> 
> barplot(dataSeries, asp=1)
> 
> Removing the asp=1 parameter produces a correct looking plot. I need to
> use the asp=1 parameter because I was re-writing the barplot function to
> create stacked charts with rounded corners (instead of rectangles). For
> the arc at the corners of the bars to look correct I need asp=1. I've
> attached a .ps file to show you what I was trying to achieve.

Marc Schwartz already made some good points.
I'd like to suggest to build your new function up on grid using 
viewports in order to finally get a clean implementation.

Uwe Ligges



> Thanks
> Kav
> 
> 
> Kavithan Siva
> Prytania Investment Advisors LLP
> 105 Ladbroke Grove, London, W11 1PG
> Tel: +44 20 7616 8475   Fax: +44 20 7616 8472
> Prytania Investment Advisors LLP is regulated by the FSA
> 
> -----Original Message-----
> From: Uwe Ligges [mailto:ligges at statistik.uni-dortmund.de] 
> Sent: Friday, January 21, 2005 11:52 AM
> To: Kavithan Siva
> Cc: r-help at stat.math.ethz.ch
> Subject: Re: [R] axis placement with stacked barplots and the asp=1
> parameter
> 
> Kavithan Siva wrote:
> 
> 
>>Hi,
>>
>>I'm currently using barplot to generate vertically stacked bar charts.
>>I'd like to be able to use the "asp=1" parameter with barplot(), but
>>doing this causes the y axis to be placed on the far left as shown in
>>the attachment demo.pdf.
> 
> 
> See the posting guide, some file types (including pdf) will be omitted 
> from your messages to R-help. You might want to specify a short but 
> easily reproducible examples in 2-5 lines of code.
> 
> Why do you want to use "asp" with a barplot???
> 
> Uwe Ligges
> 
> 
> 
>>I could get around this by using the negative values for the line
>>parameter of the axis() function. I'd rather not do this and imagine
> 
> I'm
> 
>>doing something wrong. Any help would be much appreciated.
>>
>>Thanks
>>Kav
>> 
>> ---
>>This e-mail may contain confidential and/or privileged information. If
> 
> you are not the 
> 
>>intended recipient (or have received this e-mail in error) please
> 
> notify the sender 
> 
>>immediately and destroy this e-mail. Any unauthorised copying,
> 
> disclosure or distribution 
> 
>>of the material in this e-mail is strictly forbidden. The Prytania
> 
> Group has taken every 
> 
>>reasonable precaution to ensure that any attachment to this e-mail has
> 
> been swept for 
> 
>>viruses. However, we cannot accept liability for any damage sustained
> 
> as a result of 
> 
>>software viruses and would advise that you carry out your own virus
> 
> checks before 
> 
>>opening any attachment.
>>
>>
>>
> 
> ------------------------------------------------------------------------
> 
>>______________________________________________
>>R-help at stat.math.ethz.ch mailing list
>>https://stat.ethz.ch/mailman/listinfo/r-help
>>PLEASE do read the posting guide!
> 
> http://www.R-project.org/posting-guide.html
>  
>  ---
> This e-mail may contain confidential and/or privileged inf...{{dropped}}




More information about the R-help mailing list