On 29/10/2021 8:19 p.m., Rolf Turner wrote:

I cannot get the "inset" argument in legend() to produce the results
that I want.  It seems to me that when the legend position argument is
set to "bottom" then only the second (y-component) entry of "inset"
has any effect, and when the position argument is "left" then only
the first (x-component)  entry of "inset" has any effect.

I have attached a file "legDemo.txt" which can be sourced to
demonstrate the behaviour that I am encountering.

I thought that maybe if one uses "inset" then one should not specify
the legend position, but that causes an error to be thrown.

I want to have a near the bottom of the plot and to adjust its
position, in the horizontal direction by means of "inset", but nothing
that I try has the desired effect.

Am I misunderstanding something?  Or is there perhaps a bug in
legend()?

I think it is working as designed. If you say "bottom", the y distance will be ignored: it would only be considered for things that are placed relative to the vertical margins, i.e. bottomright, bottomleft, etc. The design doesn't say what an "inset" of the middle value would be.

To move things slightly away from the middle, I think you've got to look at par("usr") and place it yourself, giving numerical values for x and y.

Duncan Murdoch

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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