[R] scientific vs. fixed notation in xyplot()

Don McKenzie dmck at u.washington.edu
Mon Sep 27 22:00:04 CEST 2010


This is quite elegant (thanks) and brings up a problem I could not  
solve awhile back, although Dr. Sarkar did his best to help.
How do I do the same thing in a panel plot?

e.g., toy example

temp.df <- data.frame(X=seq(1,100,by=1),Y=seq(1,50.5,by=.5),class=rep 
(c("A","B"),each=50))
xyplot(Y ~ X | class,data=temp.df,scales=list(x=round(log(1:100),  
4),y=round(log(1:50.5), 4),log=T))

gives me the right points on the page but still gives axis labels in  
scientific notation.

If I try to specify "labels" as a list I get an error message

 > xyplot(Y ~ X | class,data=temp.df,scales=list(log = T, labels =  
list(x=round(log(1:100), 4),y=round(log(1:50.5), 4))))

Error in construct.scales(log = TRUE, labels = list(x = c(0, 0.6931,  
1.0986,  :
   the at and labels components of scales may not be lists when  
relation = same

Syntax problem in this last command?

Thanks


On 27-Sep-10, at 12:16 PM, Henrique Dallazuanna wrote:

> Try this:
>
>  xyplot(1:10~1:10, scales=list(log = T, labels = round(log(1:10), 4)))
>
>
> On Mon, Sep 27, 2010 at 4:10 PM, array chip  
> <arrayprofile at yahoo.com> wrote:
>
>> Hi I am using xyplot() to plot on the log scale by using scale=list 
>> (log=T)
>> argument. For example:
>>
>> xyplot(1:10~1:10, scales=list(log=T))
>>
>> But the axis labels are printed as scientific notation (10^0.0, etc),
>> instead of
>> fixed notation. How can I change that to fixed notation?
>>
>> options(scipen=4) doesn't work on xyplot()
>>
>> Thanks
>>
>> John
>
> -- 
> Henrique Dallazuanna
> Curitiba-Paraná-Brasil
> 25° 25' 40" S 49° 16' 22" O
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting- 
> guide.html
> and provide commented, minimal, self-contained, reproducible code.

Don McKenzie, Research Ecologist
Pacific WIldland Fire Sciences Lab
US Forest Service

Affiliate Professor
School of Forest Resources, College of the Environment
CSES Climate Impacts Group
University of Washington

desk: 206-732-7824
cell: 206-321-5966
dmck at uw.edu
donaldmckenzie at fs.fed.us



More information about the R-help mailing list