Hi there,

I draw a multiple figure in one plot, like the following:

par(mfcol=c(1,5),mar=c(4,4,0,0)+0.2, oma=c(0,0,3,0))
plot(1:10, type = "b")
plot(1:10, type = "b")
plot(1:10, type = "b")
plot(1:10, type = "b")
plot(1:10, type = "b")

Now, I hope to plot the legend like the following:

legend("top", legend=c("Example"), pch = 21, lty = 1, merge = FALSE, horiz = TRUE, bty="n", xpd = NA)

There were two problems:

1) the legend is put inside the fifth figure instead of the top center of the whole plot, i.e., the center of the outer top margin.

Now, I use a stupid solution, I replace "top" in the above command with locator(1). However, using this solution, the plot have to be in an interactive mode, and the position is not accuracy.

2) the point is connected with the line in the legend. I hope there is a space between the two symbols, like --- o instead of ---o. If possible, put the point before the line, like o ----. Unfortunately, I don't find any way to do that.

Any suggestion will be greatly appreciated.

Regards,
Jinsong

______________________________________________
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