Skip to content
Prev 379744 / 398502 Next

URGENT help-Problem with panel barplot spacing

Thanks for the code, Rich. I now get the concept of using the lattice
library.

Most grateful for the references shared.

Regards
Kwesi
On 28 May 2019 at 19:56:06, Richard M. Heiberger (rmh at temple.edu) wrote:
I think this is what you want. You didn't send a reproducible example
(no values for djf.gcms or for cores1).

For what I think you are doing, lattice would be much simpler. It
handles the repetition within each panel for you.

## generate some data
djf.gcms <- matrix(sample(50, size=9*12, replace=TRUE), 9, 12)

library(lattice)
library(latticeExtra)

djfs <- cbind(stack(data.frame(djf.gcms)), letter=factor(letters[1:9]))
head(djfs)

tmp <-
barchart(letter ~ values | ind, group=letter, col=1:9, data=djfs,
horizontal=TRUE,
stack=TRUE, type="i",
scales=list(x=list(alternating=FALSE, axs="i", limits=c(0,59))),
origin=0, layout=c(4, 3), between=list(x=1, y=2)) +
layer(panel.text(x=x+5, y, label=x)) +
layer(panel.abline(v=seq(0,50,10), col="gray"), under=TRUE)
tmp

Rich

The best place to start learning lattice is the trellis book
http://geog.uoregon.edu/GeogR/pdfs/trellis.user.pdf

The definitive reference is Deepayan Sarkar's book,
Lattice: Multivariate Data Visualization with R
https://www.e-reading.club/bookreader.php/137342/Lattice._Multivariate_Data_Visualization_with_R.pdf

My book (HH2) is
Heiberger, Richard M. and Holland, Burt (2015).
Statistical Analysis and Data Display: An Intermediate Course with
Examples in R.
Springer, second edition. ISBN 978-1-4939- 2121-8.
https://www.springer.com/us/book/9781493921218

See HH2 Chapter 4 Graphs for a general discussion
and many examples throughout the book and in the accompanying CRAN package
HH.

install.packages("HH")

On Tue, May 28, 2019 at 6:42 AM Kwesi A. Quagraine
<starskykwesi at gmail.com> wrote:
postscript("fig_paper2_fre_obs_models_djf_1980_2013_4x3_new.eps",width=10,height=8,paper="special",horizontal=T,onefile=T)
=
=
http://www.R-project.org/posting-guide.html
------------
Try not to become a man of success but rather a man of value- Albert
Einstein

Kwesi A. Quagraine
Department of Physics
School of Physical Sciences
College of Agriculture and Natural Sciences
University of Cape Coast
Cape Coast, Ghana

Alt. Email: kwesi at csag.uct.ac.za
Web: http://www.recycleupghana.org/
Office: +27 21 650 3164
Skype: quagraine_cwasi