Hello,

I have found that in smoothScatter it is not possible to reverse the axes plotted (R version 2.9.0) .   It appears that this arises from the hard coding of xlim and ylim in smoothscatter.R in the lines :

x <- x[ xlim[1] <= x[,1] & x[,1] <=xlim[2], ]   (line  number 25)

and 

x <- x[ ylim[1] <= x[,2] & x[,2] <= ylim[2], ]  (line number 31)

This results in a x being NA if ylim[1] > ylim[2] which results in an error on executing
 map <- grDevices:::.smoothScatterCalcDensity(x, nbin, bandwidth)

To counter this problem, I replaced the above two lines by :
x <-x [min(xlim) <= x[,1] & x[,1] <= max(xlim), ]

and 
x <- x[min(ylim) <= x[,2] & x[,2] <= max(ylim), ]

and now smoothscatter reverses axes properly if xlim and/or ylim are provided with reversed ranges.   

I am wondering if this would break something somewhere else or if there is a better way to reverse the axes.     (I am a newbie in R programming although I have been using R for some astronomical plots and computations etc...) 

Thanks in advance for your comments!  
Shashi
--


 

Shashikiran Ganesh 

http://www.prl.res.in/~shashi 

http://cosmicdiary.org/blogs/shashikiran_ganesh/
Registered linux user number: 39542 (http://counter.li.org)


      Now surf faster and smarter ! Check out the new Firefox 3 - Yahoo! Edition http://downloads.yahoo.com/in/firefox/
	[[alternative HTML version deleted]]

