[R] axis scale issues....

chipmaney chipmaney at hotmail.com
Tue Sep 29 18:08:41 CEST 2009


I have read all the help on axis scales, which seems to be much harder to
deal with than it should be, given how common the need to alter axes.  
Anyway....yeah, suppress the axis using yaxt then call and define the new
scale using axis().

The problem is, this doesn't change the actual axis, only the text. 
Example:

plot(1:length(TreeDensity.df$Description[which(TreeDensity.df$Description ==
Zone.df[i])]),TreeDensity.df$CumMeanTree[which(TreeDensity.df$Description ==
Zone.df[i])],
		type = "b", sub=Zone.df[i],xlab="Sample Size",ylab = "Tree Density",
yaxt="n")
	
		axis(side = 2, xpd=FALSE, at = pretty(range(0,450)) )

This code produces the following plot:

http://www.nabble.com/file/p25665902/Presentation1.jpg 


Note that while the scale of the axis TEXT has changed, the actual axis
scale hasn't, it still ranges across the value of the data....That is, the
ranges 0...~100 and ~200....450 do not appear on the plot. 

One could say that the axis scale has changed, but part of the axis isn't
showing up, so one could use xpd to suppress clipping....However, then the
axis either runs off the device window or something, like the following
plot:

http://www.nabble.com/file/p25665902/Presentation2.jpg 

So, what I really want to do is not the change both the range (to 0...450)
AND scale (ie, shrink the length of the range(0,450) to fit the existing
plot dimensions) of the axis.  Any suggestion on how to accomplish this?

Thanks in advance...
-- 
View this message in context: http://www.nabble.com/axis-scale-issues....-tp25665902p25665902.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list