[R] It works but I don't know how (nice scientific notation with Lattice)
Ptit_Bleu
ptit_bleu at yahoo.fr
Thu Sep 20 17:03:14 CEST 2007
Hi,
I had problems to display my results in a nice way (according to me).
Thanks to posts of people of this forum, I solved my problems (ticks with a
scientific notation and how to write nicely "V/m2" in the label of the
x-axis) but ... I don't understand the script.
Can somebody explain me how the short script below writes the scientific
notation ?
I guess it is the result of
ans$bottom$labels$labels <- parse(text = ans$bottom$labels$labels)
but it is really not clear to me.
Thanks in advance for your explainations
Ptit Bleu.
--------------------------------------------------------------------
library(lattice)
x<-c(10,100,1000,10000,100000,20,200,2000,20000,200000)
y<-c(1,2,3,4,5,2,4,6,8,10)
z<-c(1,1,1,1,1,2,2,2,2,2)
xyplot(y ~ x | z,
scales = list(x = list(log = T)),
xscale.components = function(...) {
ans <- xscale.components.default(...)
ans$bottom$labels$labels <- parse(text
= ans$bottom$labels$labels)
ans
}
, xlab=(expression(paste("X (V/",m^2,")"))) , ylab="Y (arb. unit)")
--
View this message in context: http://www.nabble.com/It-works-but-I-don%27t-know-how-%28nice-scientific-notation-with-Lattice%29-tf4488112.html#a12798983
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list