[R] Fwd: Re: Graph color

Greg Snow Greg.Snow at imail.org
Fri Jan 29 03:32:58 CET 2010


the command:

> axis(4)

will put tickmarks and labels on the right, you may want to preceed the plot with something like:

> par(mar=c(5,4,4,4)+0.1)

see ?axis and ?par for details.

________________________________________
From: r-help-bounces at r-project.org [r-help-bounces at r-project.org] On Behalf Of Jose Narillos de Santos [narillosdesantos at gmail.com]
Sent: Thursday, January 28, 2010 4:08 PM
To: Jim Lemon; baptiste auguie
Cc: r-help at r-project.org
Subject: Re: [R] Fwd: Re: Graph color

Hi Jim your suggestion doesn´t work properly. I have find some documents on
graphs so let me think till monday and if not I will detail where it fails.

Sorry again...I feel very silly, really, it is not a joke but I will
continue trying...

I have a question also, in a general plot (please if you can help me it
would be fantastic)

Imagine again a plot


> x <- rnorm(10)

> y <- rnorm(10)



If I plot(x,y)



it appears a scatter plot.

If you see y axis (the y axis on the left) has numbers. But the parallel
(imaginary)  y axis on the right appears only as a line (without the
numbers, the scale).

Do you know how to show the scale the same numbers in both (left and right
axis)? I think this way the graphs seem more simetrical.

Many thanks in advance.


2010/1/28 Jim Lemon <jim at bitwrit.com.au>

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

        [[alternative HTML version deleted]]


More information about the R-help mailing list