Hello dear list,

I just cannot figure out how to do this and didn't find a solution for my 
specific problem.

I want to place a centered horizontal legend between 4 plots. That's no problem.

The problem is: As soon as I specify the "text.width" parameter to separate the 
two legend entries, the legend is not centered anymore. I thought the 'xjust' 
parameter would do what I want, but it doesn't change a thing :(

Please see this minimal example:

# Setting up the layout of plots
layout(matrix(c(1,2,3,3,4,5), nrow = 3, byrow = T), heights = c(1,0.1,1))
par(mar = c(4.3,4,2,1.5))
# plot 1
plot(rnorm(100))
# plot 2
plot(rnorm(100))
# legend as plot no.3
par(mar = c(0,0,0,0))
plot.new()
legend(x = "center", lty = c("solid", "dashed"), horiz = T,
      legend = c("Beginning", "End"), lwd = 2, bty = "n", text.width = 0.2)
par(mar = c(4.3,4,2,1.5))
# plot 4
plot(rnorm(100))
# plot 5
plot(rnorm(100))

Thanks for your help!
Sascha W.

---
Sascha Wolfer
Center for Cognitive Science
University of Freiburg
http://portal.uni-freiburg.de/cognition/wolfer

______________________________________________
R-help@r-project.org 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.

Reply via email to