Re: [R] Separating point symbols and line types in a legend.

2016-02-12 Thread Greg Snow
One option is to call `legend` twice and do some manual positioning.
This worked for me:

plot(1:10)
legend('topleft', lty=1:3, bty="n", legend=c('','','') )
legend('topleft', pch=c(20,8,1), bty="n",
legend=c('clyde','irving','melvin'), inset=c(0.1,0))

You may need to fiddle with the amount of inset for your particular
plot and device combination.



On Thu, Feb 11, 2016 at 9:52 PM, Rolf Turner  wrote:
>
> I would like to have a legend given in the manner
>
> legend("topleft",pch=c(20,8,1),lty=1:3,bty="n",
>legend=c("clyde","irving","melvin"))
>
> but with the point symbol *NOT* being superimposed on the line segments that
> are plotted.
>
> I saw that I can specify "merge=FALSE" in the call to legend() but this
> gives results like unto
>
>* irving
>
> with the plot symbol being immediately juxtaposed to the plotted line
> segment.  I would like a space between them, like so:
>
> * irving
>
> (See the difference?)
>
> I can see no arguments to legend that allow me to effect this.  I can adjust
> positioning of the legend text, but not of the plotted point character or
> line segment.  Is there any way to effect the desired result?  Or is there a
> "simple" adjustment that one could make to the code for legend() that would
> allow me to accomplish what I want?
>
> Ta.
>
> cheers,
>
> Rolf Turner
>
> --
> Technical Editor ANZJS
> Department of Statistics
> University of Auckland
> Phone: +64-9-373-7599 ext. 88276
>
> __
> 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.



-- 
Gregory (Greg) L. Snow Ph.D.
538...@gmail.com

__
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] Separating point symbols and line types in a legend.

2016-02-12 Thread Rolf Turner


Thanks Greg.  Worked perfectly!!!

cheers,

Rolf

On 13/02/16 09:22, Greg Snow wrote:

One option is to call `legend` twice and do some manual positioning.
This worked for me:

plot(1:10)
legend('topleft', lty=1:3, bty="n", legend=c('','','') )
legend('topleft', pch=c(20,8,1), bty="n",
legend=c('clyde','irving','melvin'), inset=c(0.1,0))

You may need to fiddle with the amount of inset for your particular
plot and device combination.



On Thu, Feb 11, 2016 at 9:52 PM, Rolf Turner  wrote:


I would like to have a legend given in the manner

legend("topleft",pch=c(20,8,1),lty=1:3,bty="n",
legend=c("clyde","irving","melvin"))

but with the point symbol *NOT* being superimposed on the line segments that
are plotted.

I saw that I can specify "merge=FALSE" in the call to legend() but this
gives results like unto

* irving

with the plot symbol being immediately juxtaposed to the plotted line
segment.  I would like a space between them, like so:

 * irving

(See the difference?)

I can see no arguments to legend that allow me to effect this.  I can adjust
positioning of the legend text, but not of the plotted point character or
line segment.  Is there any way to effect the desired result?  Or is there a
"simple" adjustment that one could make to the code for legend() that would
allow me to accomplish what I want?

Ta.


--
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276

__
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] Separating point symbols and line types in a legend.

2016-02-11 Thread Rolf Turner


I would like to have a legend given in the manner

legend("topleft",pch=c(20,8,1),lty=1:3,bty="n",
   legend=c("clyde","irving","melvin"))

but with the point symbol *NOT* being superimposed on the line segments 
that are plotted.


I saw that I can specify "merge=FALSE" in the call to legend() but this 
gives results like unto


   * irving

with the plot symbol being immediately juxtaposed to the plotted line 
segment.  I would like a space between them, like so:


    * irving

(See the difference?)

I can see no arguments to legend that allow me to effect this.  I can 
adjust positioning of the legend text, but not of the plotted point 
character or line segment.  Is there any way to effect the desired 
result?  Or is there a "simple" adjustment that one could make to the 
code for legend() that would allow me to accomplish what I want?


Ta.

cheers,

Rolf Turner

--
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276

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