[R] plot and bg

Martin Maechler maechler at stat.math.ethz.ch
Tue Aug 20 15:34:02 CEST 2002


>>>>> "Jim" == Jim Lemon <bitwrit at ozemail.com.au>
>>>>>     on Tue, 20 Aug 2002 22:02:22 +1000 writes:

    Jim> Olivier Martin wrote:
    >> Hi all,
    >> 
    >> I would like to plot some points and define the bg color
    >> of my graphics.  But the bg parameter set is defined for
    >> the. whole graphic.  In fact, i would like to use
    >> something like :
    >> 
    >> box(bg=gray(0.9)).
    >> 
    >> So, the background concerns only the plot region and not
    >> the main title, the x title and the y title.
    >> 

    Jim> This may not be the easiest way, but...

    >> plot(1:5,type="n")
    >> pd<-par("usr")
    >> rect(pd[1],pd[3],pd[2],pd[4],col="Gray")
    >> par(new=T)
    >> plot(1:5)

The easiest way most probably being something like

plot(1:10, panel.first = {U <- par("usr")
                     rect(U[1],U[3],U[2],U[4],col="cornsilk", border="black")},
     main = "Extra background for plot()")

------
Martin Maechler <maechler at stat.math.ethz.ch>	http://stat.ethz.ch/~maechler/
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list