[R] Axis manipulation in Stackpoly (Plotrix)

Ben Neal bneal at spg.ucsd.edu
Fri Dec 23 19:29:05 CET 2011

Thank you. That helps me understand the issue better. I came up with a similar solution . . . but yours is more elegant (I just wrote out the labels . . ).

My solution follows: 

stackpoly(CaribMatrix, stack=TRUE, xlab="Year",ylab="Catch in tons", 
          col.main="red", font.main=4,
          axis4="FALSE",  xat=seq(50,760,by=100), 
          xaxlab=c(1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000))

-----Original Message-----
From: Jim Lemon [mailto:jim at bitwrit.com.au]
Sent: Fri 12/23/2011 2:53 AM
To: Ben Neal
Cc: r-help at r-project.org
Subject: Re: [R] Axis manipulation in Stackpoly (Plotrix)
On 12/23/2011 07:52 AM, Ben Neal wrote:
> Have made a stacked area plot, but now want to manipulate the x axis: make in even increments (50) in order to suppress the tick marks (forming solid bar under plot). However, the plot functions do not seem to work, and I cannot find documentation for use of xat in stackpoly.
> This is a time series of data covering 579 years, and has been successfully converted from zoo to matrix. Data plotting fine, jsut want to change axis -
> CaribMatrix<-as.matrix(ts4Ex)
> stackpoly(CaribMatrix, stack=TRUE, xlab="Year",ylab="Catch in tons", xaxlab=(1250:2008),
>            main="Historical Florida reef fisheries catch by sector", axis4="FALSE")
> Any assistance appreciated! Thanks very much, Benjamin P Neal, Scripps Inst. of Oceanogrpahy
Hi Ben,
In the stackpoly function, you can specify the positions of the axis 
ticks (xat=...) and the labels for those positions (xaxlab=...). You 
don't seem to have supplied the "x" values, so the values in CaribMatrix 
will be placed display at 1:dim(CaribMatrix)[1]. I'll have to make up 


This seems to give a reasonable plot for me.


More information about the R-help mailing list