Skip to content

pch size in a legend

4 messages · Ahmed Attia, Jim Lemon, Chel Hee Lee +1 more

#
Hi R users,

I would like to adjust the pch size in a legend without changing the
text size, pt.cex does not do the job. R 2.15.2 32 bit.

legend(0,2100, legend=c("2009","2010","2012","2013","2014"),
col = 1,cex=1,lty=NA,pch=c(1,2,6,7,8),lwd=2,bty="n")

Thanks


Ahmed Attia, Ph.D.
Agronomist & Soil Scientist

Post-Doc Research Associate
Texas A&M AgriLife Research-Vernon
ahmed.attia at ag.tamu.edu
Cell phone: 001-979-248-5215
#
Hi Ahmed,
Hmmm, this seems to work for me (R-3.1.2, Linux)

legend(0,2100, legend=c("2009","2010","2012","2013","2014"),
 col = 1,cex=1,lty=NA,pch=c(1,2,6,7,8),lwd=2,bty="n",pt.cex=2)

Jim
On Sat, Jan 31, 2015 at 8:49 AM, Ahmed Attia <ahmedatia80 at gmail.com> wrote:
#
Hi Ahmed,

It also works with the following working environment:

 > R.version
                _
platform       x86_64-w64-mingw32
arch           x86_64
os             mingw32
system         x86_64, mingw32
status
major          3
minor          1.2
year           2014
month          10
day            31
svn rev        66913
language       R
version.string R version 3.1.2 (2014-10-31)
nickname       Pumpkin Helmet

 > unlist(.Platform)
      OS.type     file.sep   dynlib.ext          GUI       endian 
pkgType
    "windows"          "/"       ".dll"       "Rgui"     "little" 
"win.binary"
     path.sep       r_arch
          ";"        "x64"
 >

Chel Hee Lee
On 1/30/2015 9:55 PM, Jim Lemon wrote:
#
Could you provide an example of trying to use pt.cex that "does not do the
job"?

Using pt.cex works fine for me when I've used it (R version 3.1.2 both 32
bit and 64 bit).

Here's some dummy code that demonstrates that the symbol size changes w/o
changing the text size:

   plot(x=c(0,6),y=c(0,6),type="n")
   legend(x="bottomright",title="Legend 1, symbol 2 with
pt.cex=1.25",legend=c("Item 1","Item
2"),pch=c(1,1),pt.cex=c(1,1.25),col=c('black','blue'))
   legend(x="topleft",title="Legend 2, symbol 2 with
pt.cex=1.75",legend=c("Item 1","Item
2"),pch=c(1,1),pt.cex=c(1,1.75),col=c('black','blue'))

see if that works for you?


______________________________________
Allen Bingham
Bingham Statistical Consulting

aebingham2 at gmail.com


-----Original Message-----
From: Ahmed Attia [mailto:ahmedatia80 at gmail.com] 
Sent: Friday, January 30, 2015 1:50 PM
To: r-help
Subject: [R] pch size in a legend

Hi R users,

I would like to adjust the pch size in a legend without changing the text
size, pt.cex does not do the job. R 2.15.2 32 bit.

legend(0,2100, legend=c("2009","2010","2012","2013","2014"),
col = 1,cex=1,lty=NA,pch=c(1,2,6,7,8),lwd=2,bty="n")

Thanks


Ahmed Attia, Ph.D.
Agronomist & Soil Scientist

Post-Doc Research Associate
Texas A&M AgriLife Research-Vernon
ahmed.attia at ag.tamu.edu
Cell phone: 001-979-248-5215