[R] Fwd: Re: Graph color
Jim Lemon
jim at bitwrit.com.au
Thu Jan 28 02:42:12 CET 2010
On 01/28/2010 09:52 AM, Jose Narillos de Santos wrote:
> Finally I´m very near on the graph I want...
> The code is this (based on your guide):
> First I read this data on the M.txt file:
> Player TYr Dec
> Jose 20 14
> Pepe 12 16
> Andres 15 12
> Guille 16 14
> Pedro 18 19
> Luis 14 19
> Raul 18 15
> Pepe 7 5
>
> MC<-read.table("MC.txt",header=T,sep="",dec=",")
> #I read the data
> attach(MC)
>
> par(bg="black")
>
> plot(x = MC$TYr, y = MC$Dec, xlab="Actual Goals",
> ylab="Last year Goals",col="white",col.axis="white")
> title("Goals on Game",font=4,col="white")
> lim<-par("usr")
> rect(lim[1],lim[3],lim[2],lim[4],col="white",border="white")
> text(x = MC$TYr, y = MC$Dec, labels = MC$Player)
> grid()
>
> abline(1,1)
>
> WHAT IS MY PROBLEM?
> The main title and the axis names doesn´t appear I want to put them on
> white but the script doesn´t run. Can any one guide me?
> The other problem is that the border of the x and y axis doesn´t appears...
Hi Jose,
I think this will be close to what you want. The black outer background
and the white inner background obscure almost everything, and so you may
have to specify nearly everything in the plot, or keep changing par(fg)
and par(bg) as you add bits.
plot(x = MC$TYr, y = MC$Dec)
lim<-par("usr")
rect(lim[1],lim[3],lim[2],lim[4],col="white",border="white")
points(x = MC$TYr, y = MC$Dec,col="black")
axis(1,col="white")
mtext("Last year Goals",side=2,line=2,col="white")
mtext("Actual Goals",side=1,line=2,col="white")
mtext(seq(8,20,by=2),at=seq(8,20,by=2),side=1,line=1,col="white")
axis(2,col="white")
mtext(seq(6,18,by=2),at=seq(6,18,by=2),side=2,line=1,col="white")
mtext("Goals on game",at=14,line=2,cex=1.5,col="white")
grid()
abline(1,1,col="black")
box(col="white")
Jim
More information about the R-help
mailing list