I have a matrix plot of ternary diagrams (pdf attached) generated with these commands: opar <- par(xpd=NA,no.readonly=T) plot(WintersY, pch=as.numeric(WintersX4), col=c("black","red","green","blue","yellow","orange")[WintersX4]) legend(x=0.75, y=0.0, abbreviate(levels(WintersX4), minlength=1),pch=as.numeric(WintersX4), col=c("black","red","green","blue","yellow","orange"), yjust=0) par(opar) I have read ?legend but am uncertain what to adjust so the legend is readable yet not overlapping any of the plots. One of this series of plots has data from 8 years which would be a worse looking fit. How should I specify the legend (or the plots themselves) in a figure that occupies the full display? Rich -------------- next part -------------- A non-text attachment was scrubbed... Name: winters-ternary-2.pdf Type: application/pdf Size: 7997 bytes Desc: URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20150304/69b3c66d/attachment.pdf>
Why not make the legend fit on one line above or below the plot matrix? ?legend -- look at ncol=, horiz= and xpd= args On 3/4/2015 4:39 PM, Rich Shepard wrote:> I have a matrix plot of ternary diagrams (pdf attached) generated with > these commands: > > opar <- par(xpd=NA,no.readonly=T) > > plot(WintersY, pch=as.numeric(WintersX4), > col=c("black","red","green","blue","yellow","orange")[WintersX4]) > > legend(x=0.75, y=0.0, abbreviate(levels(WintersX4), > minlength=1),pch=as.numeric(WintersX4), > col=c("black","red","green","blue","yellow","orange"), yjust=0) > > par(opar) > > I have read ?legend but am uncertain what to adjust so the legend is > readable yet not overlapping any of the plots. One of this series of plots > has data from 8 years which would be a worse looking fit. > > How should I specify the legend (or the plots themselves) in a figure > that > occupies the full display? > > Rich > >
On Thu, 5 Mar 2015, Michael Friendly wrote:> Why not make the legend fit on one line above or below the plot matrix? > ?legend > -- look at ncol=, horiz= and xpd= argsMichael, That's just the pointer I was hoping to see. There's no reason not to have the legend outside the plot matrix and now I know where to experiment. Much appreciated, Rich