[R] legend: interplay between title and y.intersp
Sigbert Klinke
@|gbert @end|ng |rom w|w|@hu-ber||n@de
Sun Mar 5 08:39:41 CET 2023
Hi,
thanks, but this does not solve the problem. If I make y.intersp large
enough then it works properly. Maybe I was not clear enough: I want to
have the small distance between the lines and no overlap between the
title and the lines.
Sigbert
Am 04.03.23 um 17:59 schrieb Bert Gunter:
> Set the legend position explicitly with x and y values and add xpd = TRUE
> to the legend call to clip the plot to the figure region and not the plot
> region (the default). Something like this (you may have to fool around with
> y.intersp, etc. to allow enough space between the legend lines):
>
> plot(c(0,1), c(0,1), type="n")
>
> legend(x = .4, y = 1.25, legend=c("", "", "a"), col=c("blue", "red",
> "green"), xpd = TRUE, lty = 1, y.intersp= .75, title = 'test')
>
> Cheers,
> Bert
>
> Cheers,
> Bert
>
>
> On Sat, Mar 4, 2023 at 7:45 AM Sigbert Klinke <sigbert using wiwi.hu-berlin.de>
> wrote:
>
>> Hi,
>>
>> my MWE is not working as expected:
>>
>> plot(c(0,1), c(0,1), type="n")
>>
>> legend("top", legend=c("", "", "a"), col=c("blue", "red", "green"),
>> title="test", y.intersp=0.2, lwd=1)
>>
>> The lines are not below the title. I want (nearby) lines as in the plot,
>> but below the title. Is there a way to achieve this?
>>
>> Thanks Sigbert
>>
>> ______________________________________________
>> R-help using 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.
>>
>
--
https://hu.berlin/sk
https://www.stat.de/faqs
https://hu.berlin/mmstat
https://hu.berlin/mmstat-ar
More information about the R-help
mailing list