s-news
[Top] [All Lists]

[S]: mixing character and symbols in key

To: "'s-news@wubios.wustl.edu'" <s-news@wubios.wustl.edu>
Subject: [S]: mixing character and symbols in key
From: "Pratt, James" <jamesp@mocr.oapi.com>
Date: Wed, 20 Jan 1999 16:40:06 -0500
Sender: owner-s-news@wubios.wustl.edu
I am using S+ 4.5 in Win/NT environment.  Have created trellis plot with two
'symbol' types.  One with pch="|" to get a vertical line at the point.  The
other using pch=8, to get the asterisk symbol.  I'm trying to add a legend
to the multipanel display using key().  

+
key=list(space="bottom",points=list(pch=c("|","*"),col=c(2,5),cex=c(1,1.5),f
ont=c(1,2)),
+ text=c("Estimated Mean","Raw Mean"),x=.1,y=-.1))

The problem is that the legend '*' does not look like the plotted asterisk.
Also the legend asterisk is slightly raised (like a superscript), not
centered with its associated text string.

I looked through the statlib index and found a solution to doing this via
legend (dated Sept 1991; see at end of message).  I am wondering how to
duplicate the solution with key().  I tried the following


+ key=list(space="bottom",points=list(pch=c("|","\
"),marks=c(-1,8),col=c(2,5),cex=c(1,1.5),
+ font=c(1,2)),text=c("Estimated Mean","Raw Mean"),x=.1,y=-.1))

It left a blank in space where the asterisk was to appear.  I do not see
marks as a parameter in key(), so perhaps that aspect got lost.  I also
tried pch=("|",8) but the numeral "8" appeared in the legend not the desired
asterisk.

So, how, if possible, to get characters and symbols to appear in a legend
when using the key() function?

Thanks.

Jim Pratt
jamesp@mocr.oapi.com
 
-----From Statlib ----------
Subject: Re: Squares (pch=0) in legends 
Date: Fri, 13 Sep 91 15:54:32 -0700 
------Original message--------
The problem of displaying the pch=0 symbol as part of a legend is a bug that
was fixed in the August 1991 release of S. 
Occasionally I want to produce a legend line that has no symbol, and I have
been accomplishing this using pch=0. For example, the following legend
command 
>legend(3,4.3,c("Age at Time of Study", "", "All Ages", "10 or under", "5 or
under"),marks=c(0,0,1,2,3)) 
produces a legend that looks something like this: 
           Age at Time of Study 
           0 All Ages 
           * 10 or under 
           + 5 or under 
If the "pch=0" bug has been fixed, how can I generate such legends? 
-----end of Original message
-----Reply from Patrick Burns
I'm not sure about ATT S but in version 3.0 of S-PLUS (based on the August
91 release), you will be able to do the following: 
>legend(..., legend=c("this is for blanks", "this is squares",
>"this is A"), pch="\ A",marks=c(-1,0,-1))

 The `pch' string is four typed characters: backslash,<space> ,<sapace> , A.
The backslash-space in `pch' says don't put anything here, as does -1 in
`marks'. 
Patrick Burns pat@statsci.com


-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news

<Prev in Thread] Current Thread [Next in Thread>