[R] Axis manipulation in Stackpoly (Plotrix)

Jim Lemon jim at bitwrit.com.au
Fri Dec 23 11:53:41 CET 2011


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

CaribMatrix<-matrix(order(sample(200:500,579,TRUE),nrow=579,ncol=3)
stackpoly(CaribMatrix,stack=TRUE,ylim=c(0,1500),xat=seq(1,600,by=50),
  xaxlab=seq(1450,2000,by=50),staxx=TRUE)

This seems to give a reasonable plot for me.

Jim



More information about the R-help mailing list