Quantcast

xyplot legends

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

xyplot legends

array chip
Hi all, I

When I plot both lines and points using type=c('l', 'p') in xyplot(), if I want
to include in legend both of them using keys=list(lines=list(col=1:3),
points=list(pch=1:3)), the lines and points are plotted side by side in legend.
Is there anyway to plot the points in the middle of the lines instead?


that is the default is plotting like this:
----- o

but I want something like this:
---o---

Thanks for any suggestions

John

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: xyplot legends

David Winsemius

On Sep 13, 2010, at 6:25 PM, array chip wrote:

> Hi all, I
>
> When I plot both lines and points using type=c('l', 'p') in  
> xyplot(), if I want
> to include in legend both of them using keys=list(lines=list(col=1:3),
> points=list(pch=1:3)), the lines and points are plotted side by side  
> in legend.
> Is there anyway to plot the points in the middle of the lines instead?

It's "key", not "keys"

See if this is closer to what you had in mind:

key=list(type="o", lines=list(col=1:3,pch=1:3, size=4 )

>
>
> that is the default is plotting like this:
> ----- o
>
> but I want something like this:
> ---o---

The best I could do was:
  -o--o--o-

--
David Winsemius, MD
West Hartford, CT

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: xyplot legends

array chip
Thanks David. It almost does what I wanted, except it's plotting the point
characters 3 time for each line (left, middle and right): o---o---o

I can live with that if there is no way to get rid of the point characters at
the ends.

Thanks very much!

John





----- Original Message ----
From: David Winsemius <[hidden email]>
To: array chip <[hidden email]>
Cc: [hidden email]
Sent: Mon, September 13, 2010 4:05:04 PM
Subject: Re: [R] xyplot legends


On Sep 13, 2010, at 6:25 PM, array chip wrote:

> Hi all, I
>
> When I plot both lines and points using type=c('l', 'p') in xyplot(), if I
want
> to include in legend both of them using keys=list(lines=list(col=1:3),
> points=list(pch=1:3)), the lines and points are plotted side by side in
legend.
> Is there anyway to plot the points in the middle of the lines instead?

It's "key", not "keys"

See if this is closer to what you had in mind:

key=list(type="o", lines=list(col=1:3,pch=1:3, size=4 )

>
>
> that is the default is plotting like this:
> ----- o
>
> but I want something like this:
> ---o---

The best I could do was:
-o--o--o-

--David Winsemius, MD
West Hartford, CT

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: xyplot legends

Peter Ehlers
On 2010-09-13 17:45, array chip wrote:
> Thanks David. It almost does what I wanted, except it's plotting the point
> characters 3 time for each line (left, middle and right): o---o---o
>
> I can live with that if there is no way to get rid of the point characters at
> the ends.

You can add the 'divide=' argument to key():

  key(divide = 1, etc)

See the 'key' section in ?xyplot.

   -Peter Ehlers

>
> Thanks very much!
>
> John
>
>
>
>
>
> ----- Original Message ----
> From: David Winsemius<[hidden email]>
> To: array chip<[hidden email]>
> Cc: [hidden email]
> Sent: Mon, September 13, 2010 4:05:04 PM
> Subject: Re: [R] xyplot legends
>
>
> On Sep 13, 2010, at 6:25 PM, array chip wrote:
>
>> Hi all, I
>>
>> When I plot both lines and points using type=c('l', 'p') in xyplot(), if I
> want
>> to include in legend both of them using keys=list(lines=list(col=1:3),
>> points=list(pch=1:3)), the lines and points are plotted side by side in
> legend.
>> Is there anyway to plot the points in the middle of the lines instead?
>
> It's "key", not "keys"
>
> See if this is closer to what you had in mind:
>
> key=list(type="o", lines=list(col=1:3,pch=1:3, size=4 )
>
>>
>>
>> that is the default is plotting like this:
>> ----- o
>>
>> but I want something like this:
>> ---o---
>
> The best I could do was:
> -o--o--o-
>
> --David Winsemius, MD
> West Hartford, CT
>

______________________________________________
[hidden email] 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.
Loading...