[R] Lattice xyplot log scale labels help!

2011-09-15 Thread Cram Rigby
I have a problem with lattice log scales that I could use some help with.

I'm trying to print log y-axis scales without exponents in the labels.
 A similar thread with Deepayan' recommendation is here:
http://tolstoy.newcastle.edu.au/R/e11/help/10/09/9865.html.  For
example, this code using xyplot produces a logged y-axis but the
labels  (e.g. 10^1.2) are not very user-friendly:

xyplot(24:300~24:300, scales=list(y=list(log=T)))

So, trying another y.scale.component function, we get something more
agreeable for y-axis scale labels:

xyplot(24:300~24:300, scales=list(y=list(log=T)), yscale.components =
yscale.components.log10.3)


However, my problem is that occasionally I'll have to plot data that
doesn't quite work.  For example, in the following example, I only
get one y-axis scale label:

xyplot(11:30~11:30, scales=list(y=list(log=T)), yscale.components =
yscale.components.log10.3)

or worse, no y-axis scale labels:

xyplot(11:19~11:19, scales=list(log=T), yscale.components =
yscale.components.log10.3)


What would be most helpful is if someone can show me how to use an
xyplot y-scale function to mimic log y-scale labels generated with the
standard plot command.  This seems to work regardless of the
underlying data range:

plot(11:30,11:30,log = y)
plot(24:300,24:300,log=y)


Thanks for any input!

__
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.


[R] Colors in bwplot with drop.unused.levels=F

2011-02-23 Thread Cram Rigby
Hi,

I see an inconsistency with how color vectors are handled in bwplot.
I wanted to create side-by-side boxplots with alternating colors so I
used the interaction command to create an interaction of two factors.

bwplot(value ~ interaction(response,dose), data=test,
drop.unused.levels=F,fill=c(blue,red))

By using drop.unused.levels=F, what I was hoping for was an
alternating color for each interaction level.  This works when there
is data for each level.  However, when a level is unused, the next
color in the sequence is not used and then my alternating colors go
out of sync.  Note that the standard boxplot command does do the
expected thing by applying a color for every level, even when a
level has no data: E.g.

boxplot(value ~ interaction(response,dose), data=text, col=cols)

Is there a way to force bwplot to apply a color for every level,
including the unused levels?

Thanks!

__
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.