Re: [R] Fwd: Re: Graph color

2010-02-01 Thread Greg Snow
What you are asking (making labels of points not overlap the points) is either 
very simple or very complicated, depending on your data and what you want the 
results to look like.

It may be as simple as text(x, y-strheight('A'), labels).

If that does not do what you want, then there is thigmophobe.labels in the 
plotrix package (already mentioned by Jim Lemon) which works great for some 
datasets.  Also spread.labels (plotrix package) and spread.labs (TeachingDemos 
package) work in different situations.  There may be some other automated 
attempts in other packages, but they are not coming to mind.  A less automatic 
approach that gives you more control is the dynIdentify/TkIdentify functions 
(TeachingDemos package).

If you want rectangles around the labels, then you may want the boxed.labels 
function (plotrix).  If you want to do your own rectangles then there are the 
rect and symbols functions.

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
 project.org] On Behalf Of Jose Narillos de Santos
 Sent: Friday, January 29, 2010 4:30 PM
 To: Jim Lemon; r-help@r-project.org; baptiste auguie
 Subject: Re: [R] Fwd: Re: Graph color
 
 Hi Jim,
 
 Last question.
 
 I´m using a spanish version (there are some documents on how
 constructing
 good plots and I have found them althought not very intuitive...) I
 will
 read them in a next days.
 
 Only if you know the way.
 
 Imagine I have made a plot like plot(x,y)
 
 and I use labels (on each cross point appears a name) but they appear
 on the
 dot ¿Do you know some way to show the label below the dot? there is
 some way
 to indicate the program try to not to overlap labels (if they are very
 near?)
 
 Happy nice wekend all¡¡¡
 
 2010/1/29 Jim Lemon j...@bitwrit.com.au
 
  On 01/29/2010 10:08 AM, Jose Narillos de Santos wrote:
 
  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.
 
  Hi Jose,
  Try this:
 
  par(mar=c(5,4,4,4))
  plot(rnorm(10),rnorm(10))
  axis(4)
 
  Jim
 
 
 
   [[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Fwd: Re: Graph color

2010-02-01 Thread Jose Narillos de Santos
Hi Greg,

Many thanks¡¡¡

For the moment, as Jim suggested thigmophobe.labels in the plotrix package
worked properly¡¡¡

Many thanks¡¡¡



2010/2/1 Greg Snow greg.s...@imail.org

 What you are asking (making labels of points not overlap the points) is
 either very simple or very complicated, depending on your data and what you
 want the results to look like.

 It may be as simple as text(x, y-strheight('A'), labels).

 If that does not do what you want, then there is thigmophobe.labels in the
 plotrix package (already mentioned by Jim Lemon) which works great for some
 datasets.  Also spread.labels (plotrix package) and spread.labs
 (TeachingDemos package) work in different situations.  There may be some
 other automated attempts in other packages, but they are not coming to mind.
  A less automatic approach that gives you more control is the
 dynIdentify/TkIdentify functions (TeachingDemos package).

 If you want rectangles around the labels, then you may want the
 boxed.labels function (plotrix).  If you want to do your own rectangles then
 there are the rect and symbols functions.

 Hope this helps,

 --
 Gregory (Greg) L. Snow Ph.D.
 Statistical Data Center
 Intermountain Healthcare
 greg.s...@imail.org
 801.408.8111


  -Original Message-
  From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
  project.org] On Behalf Of Jose Narillos de Santos
  Sent: Friday, January 29, 2010 4:30 PM
  To: Jim Lemon; r-help@r-project.org; baptiste auguie
  Subject: Re: [R] Fwd: Re: Graph color
 
   Hi Jim,
 
  Last question.
 
  I´m using a spanish version (there are some documents on how
  constructing
  good plots and I have found them althought not very intuitive...) I
  will
  read them in a next days.
 
  Only if you know the way.
 
  Imagine I have made a plot like plot(x,y)
 
  and I use labels (on each cross point appears a name) but they appear
  on the
  dot ¿Do you know some way to show the label below the dot? there is
  some way
  to indicate the program try to not to overlap labels (if they are very
  near?)
 
  Happy nice wekend all¡¡¡
 
  2010/1/29 Jim Lemon j...@bitwrit.com.au
 
   On 01/29/2010 10:08 AM, Jose Narillos de Santos wrote:
  
   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.
  
   Hi Jose,
   Try this:
  
   par(mar=c(5,4,4,4))
   plot(rnorm(10),rnorm(10))
   axis(4)
  
   Jim
  
  
 
[[alternative HTML version deleted]]



[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Fwd: Re: Graph color

2010-01-30 Thread Jose Narillos de Santos
Many thanks I will try to check it latter¡¡¡

One more think...

To add a box on a plot (and locate where you want (I think you will say
floating)) you know the function? Not a Lengend but something similar but
writting what you want inside to indicate wat you want.

2010/1/30 Jim Lemon j...@bitwrit.com.au

 On 01/30/2010 10:29 AM, Jose Narillos de Santos wrote:

 Hi Jim,
 Last question.
 I惴 using a spanish version (there are some documents on how

 constructing good plots and I have found them althought not very
 intuitive...) I will read them in a next days.
 Only if you know the way.
 Imagine I have made a plot like plot(x,y)
 and I use labels (on each cross point appears a name) but they appear on
 the dot æ¾³o you know some way to show the label below the dot? there is

 some way to indicate the program try to not to overlap labels (if they
 are very near?)

 Hi Jose,
 In fact, I can point you to the thigmophobe.labels function in the plotrix
 package, which attempts to avoid collisions between labels in just that
 manner.

 Jim



[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Fwd: Re: Graph color

2010-01-29 Thread Jose Narillos de Santos
Hi Jim,

Last question.

I´m using a spanish version (there are some documents on how constructing
good plots and I have found them althought not very intuitive...) I will
read them in a next days.

Only if you know the way.

Imagine I have made a plot like plot(x,y)

and I use labels (on each cross point appears a name) but they appear on the
dot ¿Do you know some way to show the label below the dot? there is some way
to indicate the program try to not to overlap labels (if they are very
near?)

Happy nice wekend all¡¡¡

2010/1/29 Jim Lemon j...@bitwrit.com.au

 On 01/29/2010 10:08 AM, Jose Narillos de Santos wrote:

 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.

 Hi Jose,
 Try this:

 par(mar=c(5,4,4,4))
 plot(rnorm(10),rnorm(10))
 axis(4)

 Jim



[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Fwd: Re: Graph color

2010-01-29 Thread Jim Lemon

On 01/30/2010 10:29 AM, Jose Narillos de Santos wrote:

Hi Jim,
Last question.
I´m using a spanish version (there are some documents on how
constructing good plots and I have found them althought not very
intuitive...) I will read them in a next days.
Only if you know the way.
Imagine I have made a plot like plot(x,y)
and I use labels (on each cross point appears a name) but they appear on
the dot ¿Do you know some way to show the label below the dot? there is
some way to indicate the program try to not to overlap labels (if they
are very near?)

Hi Jose,
In fact, I can point you to the thigmophobe.labels function in the 
plotrix package, which attempts to avoid collisions between labels in 
just that manner.


Jim

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Fwd: Re: Graph color

2010-01-28 Thread Jose Narillos de Santos
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 j...@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
 Jose20  14
 Pepe12  16
 Andres  15  12
 Guille  16  14
 Pedro   18  19
 Luis14  19
 Raul18  15
 Pepe7   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]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Fwd: Re: Graph color

2010-01-28 Thread Greg Snow
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-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf Of 
Jose Narillos de Santos [narillosdesan...@gmail.com]
Sent: Thursday, January 28, 2010 4:08 PM
To: Jim Lemon; baptiste auguie
Cc: r-help@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 j...@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
 Jose20  14
 Pepe12  16
 Andres  15  12
 Guille  16  14
 Pedro   18  19
 Luis14  19
 Raul18  15
 Pepe7   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]]
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Fwd: Re: Graph color

2010-01-27 Thread Jose Narillos de Santos
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...

Sorry about my silly questions...

2010/1/27 Jim Lemon j...@bitwrit.com.au

 On 01/27/2010 06:41 AM, narillosdesan...@gmail.com wrote:

 No mate,

 Sorry first of all about my indefinition (I´m Spanish, I´m improving
 everyday but a long road to the perfection). Sorry pleae.

 Second, also it is diffcoult sometimes to express what we try (sorry and
 many thanks just for reading of course for helping).

 Imagine you plot

 X=[2 4 6 8] front a Y=[6 5 8 7]

 When you plot it by default all is white what I want is to use
 par(br=gray) to make the graph gray but I want that the area (the
 imaginary square defined by the axis) not to be gray I want to deffine its
 colour by ie lightblue.


 So the image will be a square image outside gray and on the axis area (not
 the dots, points or bar plots) the area in lightblue.

 I don´t now if I have expressed well if not latter I will send an example,
 ok?

 Hi,
 You can make the background of the plot area a different color:

 # first set up the plot
 plot(X,Y,type=n,...)
 # get the coordinates of the edges of the plot
 xylim-par(usr)
 # then display a rectangle that fills it
 rect(xylim[1],xylim[3],xylim[2],xylim[4],
  col=lightblue,border=black)
 # then plot the points over the rectangle
 points(X,Y,type=b)

 Jim


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Fwd: Re: Graph color

2010-01-27 Thread Jim Lemon

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
Jose20  14
Pepe12  16
Andres  15  12
Guille  16  14
Pedro   18  19
Luis14  19
Raul18  15
Pepe7   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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Fwd: Re: Graph color

2010-01-26 Thread narillosdesantos
No mate,

Sorry first of all about my indefinition (I´m Spanish, I´m improving  
everyday but a long road to the perfection). Sorry pleae.

Second, also it is diffcoult sometimes to express what we try (sorry and  
many thanks just for reading of course for helping).

Imagine you plot

X=[2 4 6 8] front a Y=[6 5 8 7]

When you plot it by default all is white what I want is to use  
par(br=gray) to make the graph gray but I want that the area (the  
imaginary square defined by the axis) not to be gray I want to deffine its  
colour by ie lightblue.

So the image will be a square image outside gray and on the axis area (not  
the dots, points or bar plots) the area in lightblue.

I don´t now if I have expressed well if not latter I will send an example,  
ok?

Many thanks

-- Mensaje reenviado --
De: Kyle. ambe...@gmail.com
Fecha:
Asunto: Re: [R] Graph color
Para: Jose Narillos de Santos narillosdesan...@gmail.com
CC: r-help@r-project.org


 If I understand what you want correctly, you'll probably want to use  
 the col argument in whatever base graphics function you're using,  
 rather than changing something in the graphical parameters. For example,  
 if I wanted to add red points to an existing plot, I would use something  
 like





 points(c(1:10), col=red)


 Or, if I wanted to generate a barplot using a shading color other than  
 gray,


 barplot(c(1:10), col=steelblue)






 Does that answer your question?




 Kyle H. Ambert
 Fellow, National Library of Medicine
 Department of Medical Informatics  Clinical Epidemiology




 Oregon Health  Science University





 On Tue, Jan 26, 2010 at 6:44 AM, Jose Narillos de Santos  
 narillosdesan...@gmail.com wrote:




 Hi all I want to apply different colors on a simple plot:





 If I type par(br=gray) before a plot it puts all the image in gray but


 (imagine I run a simple plot) want to let the centrall box (where the dots


 are plotted) in white or image in lightblue.





 Can anyone guide me to apply this second step (make the box where the  
 series


 are plotted in different colours).





 Thanks in advance.





 [[alternative HTML version deleted]]





 __


 R-help@r-project.org mailing list


 https://stat.ethz.ch/mailman/listinfo/r-help


 PLEASE do read the posting guide  
 http://www.R-project.org/posting-guide.html


 and provide commented, minimal, self-contained, reproducible code.









[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Fwd: Re: Graph color

2010-01-26 Thread baptiste auguie
Hi,

Try this,

x - seq(0, 10, len = 100)
y - jitter(sin(x), 1000)

old.par - par()
par(bg=grey(0.5))

plot(x, y, new = TRUE, t = n)
lims - par(usr)

plot(x, y, col = 1,
  panel.first = {
rect(lims[1], lims[3], lims[2], lims[4],
  col = lightblue) })

HTH,

baptiste

2010/1/26  narillosdesan...@gmail.com:
 No mate,

 Sorry first of all about my indefinition (I´m Spanish, I´m improving
 everyday but a long road to the perfection). Sorry pleae.

 Second, also it is diffcoult sometimes to express what we try (sorry and
 many thanks just for reading of course for helping).

 Imagine you plot

 X=[2 4 6 8] front a Y=[6 5 8 7]

 When you plot it by default all is white what I want is to use
 par(br=gray) to make the graph gray but I want that the area (the
 imaginary square defined by the axis) not to be gray I want to deffine its
 colour by ie lightblue.

 So the image will be a square image outside gray and on the axis area (not
 the dots, points or bar plots) the area in lightblue.

 I don´t now if I have expressed well if not latter I will send an example,
 ok?

 Many thanks

 -- Mensaje reenviado --
 De: Kyle. ambe...@gmail.com
 Fecha:
 Asunto: Re: [R] Graph color
 Para: Jose Narillos de Santos narillosdesan...@gmail.com
 CC: r-help@r-project.org


 If I understand what you want correctly, you'll probably want to use
 the col argument in whatever base graphics function you're using,
 rather than changing something in the graphical parameters. For example,
 if I wanted to add red points to an existing plot, I would use something
 like





 points(c(1:10), col=red)


 Or, if I wanted to generate a barplot using a shading color other than
 gray,


 barplot(c(1:10), col=steelblue)






 Does that answer your question?




 Kyle H. Ambert
 Fellow, National Library of Medicine
 Department of Medical Informatics  Clinical Epidemiology




 Oregon Health  Science University





 On Tue, Jan 26, 2010 at 6:44 AM, Jose Narillos de Santos
 narillosdesan...@gmail.com wrote:




 Hi all I want to apply different colors on a simple plot:





 If I type par(br=gray) before a plot it puts all the image in gray but


 (imagine I run a simple plot) want to let the centrall box (where the dots


 are plotted) in white or image in lightblue.





 Can anyone guide me to apply this second step (make the box where the
 series


 are plotted in different colours).





 Thanks in advance.





 [[alternative HTML version deleted]]





 __


 R-help@r-project.org mailing list


 https://stat.ethz.ch/mailman/listinfo/r-help


 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html


 and provide commented, minimal, self-contained, reproducible code.









        [[alternative HTML version deleted]]


 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Fwd: Re: Graph color

2010-01-26 Thread Jim Lemon

On 01/27/2010 06:41 AM, narillosdesan...@gmail.com wrote:

No mate,

Sorry first of all about my indefinition (I´m Spanish, I´m improving
everyday but a long road to the perfection). Sorry pleae.

Second, also it is diffcoult sometimes to express what we try (sorry and
many thanks just for reading of course for helping).

Imagine you plot

X=[2 4 6 8] front a Y=[6 5 8 7]

When you plot it by default all is white what I want is to use
par(br=gray) to make the graph gray but I want that the area (the
imaginary square defined by the axis) not to be gray I want to deffine its
colour by ie lightblue.

So the image will be a square image outside gray and on the axis area (not
the dots, points or bar plots) the area in lightblue.

I don´t now if I have expressed well if not latter I will send an example,
ok?


Hi,
You can make the background of the plot area a different color:

# first set up the plot
plot(X,Y,type=n,...)
# get the coordinates of the edges of the plot
xylim-par(usr)
# then display a rectangle that fills it
rect(xylim[1],xylim[3],xylim[2],xylim[4],
 col=lightblue,border=black)
# then plot the points over the rectangle
points(X,Y,type=b)

Jim

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.