Hi,
I'am trying to make a multiple bar plot over a map and I'm having difficulties
with the distance
between axes labels and the axis. Trying to control this with mgp does not
help because it
controls both axes simultaneously. For example, with default values (mgp =
c(3, 1, 0)) y-axis
labels are ok, but x-axis labels are not. Setting mgp = c(3, 0, 0) gives good
x-axis labels but
the y-axis labels are over the axis. Since I'm using subplot() from
TechingDemos package I
don't know how to pass the mgp argument for every axis (like : axis(2, mgp =
c(3, 1, 0)).
I'm using R version 2.5.0 with Windows XP
##
sim.data <- array(runif(420), dim = c(4, 5, 7, 3),
dimnames = list(paste("var", 1:4, sep = ""), paste("year", 1:5, sep = ""),
paste("lat", 1:7, sep = ""), paste("lon", 1:3, sep = "")) )
x.pos <- c(3, 6, 9)
y.pos <- c(1,2,3,4,5,6,7)
## This will be the map, its empty in this example
plot(x = 1:10, y = 1:10, type = "n", xlim = c(1, 10), ylim = c(1,8) )
## And now the bar plots
for (l in 7:1) {
for (m in 1:3) {
subplot(barplot(sim.data[, , l, m], las = 1, names.arg = paste("year",
1:5),
mgp = c(3, 0, 0), cex.axis = 0.7, cex.names = 0.7,),
x = x.pos[m], y = y.pos[l], size = c(1.3,0.5), vadj = 0 )
}
}
Any hints ?
Héctor
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.