[R] package "plotrix"

Jim Lemon jim at bitwrit.com.au
Mon Jul 19 10:58:46 CEST 2010


On 07/19/2010 01:59 AM, mauede at alice.it wrote:
> I installed package plotrix because reading its vignette it looks like
> it can help me solve a "legend" problem.
> The package instaleed correctly on my Mac OS/X 10.5.8
> But I cannot reproduce the examples centered on function "lgendg".
>  > library(plotrix)
>  > plot(0.5,0.5,xlim=c(0,1),ylim=c(0,1),type="n",
> + main="Test of grouped legend function")
>  > legendg(0.5,0.8,c("one","two","three"),pch=list(1,2:3,4:6),
> + col=list(2,3:4,5:7))
> Error: could not find function "legendg"
>
> My problem with the regular R "legend" function is that I cannot
> indicate in the legend the line plotted by the command "abline"
> Here is the code. Attached is the plot. Any suggestion is welcome. Thank
> you.

Hi Maura,
The legendg function is fairly new, so you probably have an older 
version of plotrix. From your example, I suspect that the second last 
line (split into two lines below) should read:

  col = c("red4","green","magenta1","cyan","black"),
  text.col = "black",lty=c(-1,-1,-1,1,1),

and thus I don't think you really need legendg.

Jim



More information about the R-help mailing list