[R] lattice: control panel extent on device
btupper at bigelow.org
Tue Oct 25 17:30:50 CEST 2016
I have used latticeExtra for layering graphics. I'm not sure how I would use it to align graphics rather superimposing them.
I shall look into the the custom panel plot but that is very new territory for me.
> On Oct 25, 2016, at 9:13 AM, Bert Gunter <bgunter.4567 at gmail.com> wrote:
> Write a custom panel function for levelplot() that calls panel.xyplot after panel.levelplot. I believe this can also be done by the + operator of the latticeExtra package.
> You do *not* want to call xyplot after levelplot, as that completely redraws the plot.
> On Oct 25, 2016 2:55 PM, "Ben Tupper" <btupper at bigelow.org <mailto:btupper at bigelow.org>> wrote:
> I am drawing a levelplot and an xyplot on a single device as shown in the runnable example below. I would like the x axes to align - that is for them to cover the same extent left-to-right on the device. How do I go about doing that?
> # START
> d <- dim(volcano)
> xy <- data.frame(x = 1:d, y = volcano[,30] )
> vol_p <- levelplot(volcano)
> xy_p <- xyplot(y ~ x, data = xy)
> print(vol_p, split = c(1, 2, 1, 2), more = TRUE)
> print(xy_p, split = c(1, 1, 1, 2), more = FALSE)
> > sessionInfo()
> R version 3.3.1 (2016-06-21)
> Platform: x86_64-apple-darwin13.4.0 (64-bit)
> Running under: OS X 10.11.6 (El Capitan)
>  en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
> attached base packages:
>  stats graphics grDevices utils datasets methods base
> other attached packages:
>  lattice_0.20-33
> loaded via a namespace (and not attached):
>  tools_3.3.1 grid_3.3.1
> Ben Tupper
> Bigelow Laboratory for Ocean Sciences
> 60 Bigelow Drive, P.O. Box 380
> East Boothbay, Maine 04544
> http://www.bigelow.org <http://www.bigelow.org/>
> R-help at r-project.org <mailto:R-help at r-project.org> mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help <https://stat.ethz.ch/mailman/listinfo/r-help>
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html <http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
Bigelow Laboratory for Ocean Sciences
60 Bigelow Drive, P.O. Box 380
East Boothbay, Maine 04544
[[alternative HTML version deleted]]
More information about the R-help