Skip to content
Prev 280823 / 398503 Next

Axis manipulation in Stackpoly (Plotrix)

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:
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