[R] package "plotrix"

mauede at alice.it mauede at alice.it
Sun Jul 18 17:59:37 CEST 2010


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


x11(width=10,heigh=8)
plot(NN,LB,xlim=c(1,300),ylim=c(0,3),
     main="Intrinsic Dimensionality of 1D Helix",font.main=2,cex.main=2,col.main="red",
     xlab="Number of Nearest-Neighbors",ylab="Estimated  Dimension",col.lab="red",cex.lab=1,font.lab=2,
	 xaxt="n",yaxt="n",pch=19,col="red4")
axis(1,at=NN[1:40],labels=NN[1:40],cex.lab=1,cex.axis=0.8,col.axis="blue",lwd.ticks=0.5,col.ticks ="gray3")
axis(2,at=c(0,0.5,1,1.5,2,2.5,3,3.5,4),labels=c(0,0.5,1,1.5,2,2.5,3,3.5,4),cex.lab=1,cex.axis=0.8,
	 col.axis="blue",lwd.ticks=0.5,col.ticks ="gray3")
lines(NN,McG,pch=18,col="green")
lines(NN,PBJD,pch=20,col="magenta1")
points(NN,GRPR,pch=18,col="cyan") 
abline(h=1,pch= 1,lty=1,col="black") 
legend("topright",legend = c("Levina-Bickel","MacKay-Ghahramani","Pettis-Bailey-Jain-Dubes","Grassberger-Procaccia","Helix Dimension"),
       text.width = strwidth("Pettis-Bailey-Jain-Dubes"),pch = c(19,18,20,18,1),
	   col = c("red4","green","magenta1","cyan","black"),text.col = "black",lty=c(-1,-1,-1,1),
	   bg ="snow")

















e tutti i telefonini TIM!
Vai su 


More information about the R-help mailing list