[R] lattice: control panel extent on device

Duncan Mackay dulcalma at bigpond.com
Wed Oct 26 02:56:10 CEST 2016


Hi Ben

A bit kludgy but it works. Further refinement by eye

print(vol_p, position = c(0,0,1,0.5), more = TRUE)
print(xy_p, position = c(0.14,0.5,0.86,1), more = FALSE)

I do not know if viewports will be  any better

Regards

Duncan

Duncan Mackay
Department of Agronomy and Soil Science
University of New England
Armidale NSW 2351
Email: home: mackay at northnet.com.au

-----Original Message-----
From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Ben Tupper
Sent: Tuesday, 25 October 2016 23:53
To: r-help
Subject: [R] lattice: control panel extent on device

Hello,

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
#######
library(lattice)

d <- dim(volcano)
xy <- data.frame(x = 1:d[1], 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)
######
#END
######


Thanks!
Ben


> 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)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] lattice_0.20-33

loaded via a namespace (and not attached):
[1] 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

______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.



More information about the R-help mailing list