Re: [R] legend: interplay between title and y.intersp

2023-03-06 Thread Sigbert Klinke

Hi,

that is perfect.

Thanks Sigbert

Am 06.03.23 um 13:08 schrieb Uwe Ligges:

What about

  plot(c(0,1), c(0,1), type="n")
  legend("top", legend=c("", "a", ""), col=c("blue", "red", "green"), 
title="test", y.intersp=c(1,-0.4), lwd=1)


(in recent versions of R)

Best,
Uwe



--
https://hu.berlin/sk
https://www.stat.de/faqs
https://hu.berlin/mmstat
https://hu.berlin/mmstat-ar

__
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.


Re: [R] legend: interplay between title and y.intersp

2023-03-06 Thread Uwe Ligges

What about

 plot(c(0,1), c(0,1), type="n")
 legend("top", legend=c("", "a", ""), col=c("blue", "red", "green"), 
title="test", y.intersp=c(1,-0.4), lwd=1)


(in recent versions of R)

Best,
Uwe










On 06.03.2023 11:34, Sigbert Klinke wrote:

Hi,

I think you are right, legend cannot do it. I have now created my own 
legend function where I changed only one line and now it works the way I 
want it to. But I'm not sure if that might not have other side effects.




I have the impression that the legend and the title start at the same 
y-position (try y.intersp=0). Only if y.intersp is big enough, then it 
leads to a non-overlap of title and legend.


Thanks a lot

Sigbert

Am 05.03.23 um 16:20 schrieb Bert Gunter:

Don't think you can do that.
But maybe someone else will show that I'm wrong.

-- Bert

On Sat, Mar 4, 2023 at 11:39 PM Sigbert Klinke 


wrote:


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 


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@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







__
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.


__
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.


Re: [R] legend: interplay between title and y.intersp

2023-03-06 Thread Sigbert Klinke

Hi,

I think you are right, legend cannot do it. I have now created my own 
legend function where I changed only one line and now it works the way I 
want it to. But I'm not sure if that might not have other side effects.




I have the impression that the legend and the title start at the same 
y-position (try y.intersp=0). Only if y.intersp is big enough, then it 
leads to a non-overlap of title and legend.


Thanks a lot

Sigbert

Am 05.03.23 um 16:20 schrieb Bert Gunter:

Don't think you can do that.
But maybe someone else will show that I'm wrong.

-- Bert

On Sat, Mar 4, 2023 at 11:39 PM Sigbert Klinke 
wrote:


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 
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@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






--
https://hu.berlin/sk
https://www.stat.de/faqs
https://hu.berlin/mmstat
https://hu.berlin/mmstat-ar
__
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.


Re: [R] legend: interplay between title and y.intersp

2023-03-04 Thread Sigbert Klinke

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 
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@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

__
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.


Re: [R] legend: interplay between title and y.intersp

2023-03-04 Thread 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 
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@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.
>

[[alternative HTML version deleted]]

__
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.


[R] legend: interplay between title and y.intersp

2023-03-04 Thread Sigbert Klinke

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@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.