On Wed, Jan 16, 2013 at 12:05 PM, Patrick Connolly < p_conno...@slingshot.co.nz> wrote:
> On Mon, 07-Jan-2013 at 10:21PM +1100, Roland Seubert wrote: > > |> Hello all, > |> > |> I would like to make a parallel coordinate plot with lattice. The > |> plot should have vertical log scale axes, and should in principle > |> look like this one (I put less chemical elements in my example > |> below): > |> > |> http://www.geokem.com/images/scans/epr-and-N_Chile_Ridge.gif > |> > |> The data I am trying to plot are chemical analyses of rock samples > |> (data frame "df"). The data needs to be normalised against a > |> reference sample (vector "norm"), to get the actual data to be > |> plotted (data frame "df_n"). Here is a simplified example: > |> > |> > df <- data.frame(La = c(3.0, 2.9, 2.7), Eu = c(0.86, 0.76, 0.66), > |> Lu = c(0.07, 0.04, 0.04), row.names = c("sample1", "sample2", > |> "sample3")) > |> > norm <- c(0.237, 0.0563, 0.0246) > |> > df_n <- df / norm > |> > df_n > |> La Eu Lu > |> sample1 12.65823 3.628692 0.2953586 > |> sample2 51.50977 13.499112 0.7104796 > |> sample3 109.75610 26.829268 1.6260163 > |> > |> The plot needs the same scale for all axes, so my simple panel > |> function would be: > |> > |> > panel.myplot <- function(..., common.scale) {panel.parallel(..., > |> common.scale = TRUE)} > |> > |> I tried to plot the data with the following command to get vertical > |> axes with a log scale: > |> > |> > parallelplot(~ df_n, panel = panel.myplot, horizontal.axis = > |> FALSE, scales = list(y = list(log = 10))) > |> > |> The problem is that lattice simply ignores the log scale and gives > |> me the following warning: > |> > |> Warning message: > |> In parallelplot.formula(~df_n, panel = panel.spiderplot, > |> horizontal.axis = FALSE, : > |> cannot have log y-scale > > Check out how to use the scales list in the help for xyplot(). You > might need to brush up on how the help for axis() to see which > parameters you need to set. > > Actually I don't think that's the OP's problem. My guess the attempt to set the scale for y was because horizontal.axis = FALSE, which makes intuitive sense but unfortunately is wrong for parallelplot (which uses y.scales for annotation of the categories regardless of direction). OP, try c(parallelplot(~ df_n, horizontal.axis = FALSE, scales=list(x = list(log = TRUE))) , parallelplot(~ df_n, horizontal.axis = FALSE)) Cheers > HTH > > -- > ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. > ___ Patrick Connolly > {~._.~} Great minds discuss ideas > _( Y )_ Average minds discuss events > (:_~*~_:) Small minds discuss people > (_)-(_) ..... Eleanor Roosevelt > > ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. > > ______________________________________________ > R-help@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. > [[alternative HTML version deleted]] ______________________________________________ R-help@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.