Skip to content

misalignment of x-axis when overlaying two plots using latticeExtra

2 messages · Sean Zhang, Felix Andrews

#
Hi Sean,

as.layer() does not do what you think it does: it does not attempt to
plot things on a common scale, it simply draws the panels of two
lattice plots in the same space. Actually, it is not very useful on
its own.

What you want is doubleYScale() in the development version (0.5-5) of
latticeExtra. You can install it with
install.packages("latticeExtra", repos="http://R-Forge.R-project.org")
then
doubleYScale(barchart.obj, dot.outcome)

By the way, wise persons say plotting on multiple scales is often a
bad idea. I would at least make sure both axes start from zero.

-Felix

2009/1/15 Sean Zhang <seanecon at gmail.com>: