[R] Fwd: Re: Graph color
Jim Lemon
jim at bitwrit.com.au
Wed Jan 27 08:38:53 CET 2010
On 01/27/2010 06:41 AM, narillosdesantos at 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
More information about the R-help
mailing list