Ramon Diaz-Uriarte <ramon-diaz at teleline.es> writes:> Dear all, > > I am trying to prepare some figures where I'd like the color of the plot region > (i.e., the area bounded by the axes) to be different from the margin area > (i.e., the area of the figure not within the axes region). I can use "bg" but > that changes the background of everything? How can I accomplish what I want?I think one is stuck with things like plot(2:10,type="n") do.call("rect",c(as.list(par("usr")[c(1,3,2,4)]),list(col="pink"))) points(2:10) (or for the middle line, somewhat simpler bb <- par("usr") rect(bb[1],bb[3],bb[2],bb[4], col="pink") ) -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Dear all, I am trying to prepare some figures where I'd like the color of the plot region (i.e., the area bounded by the axes) to be different from the margin area (i.e., the area of the figure not within the axes region). I can use "bg" but that changes the background of everything? How can I accomplish what I want? Thanks, Ramon -- Ramón Díaz-Uriarte Triana 47 28016 Madrid Spain email:ramon-diaz at teleline.es Phone: +-34-917-730-620 +-34-657-186-407 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Use "par" to find out where the boundaries/axes are, and "rect" to draw the picture ... the 6th plot in demo(graphics) does the same thing. For example: ## code for coloring background x <- runif(10) y <- runif(10) plot(x,y,type="n") u <- par("usr") rect(u[1],u[3],u[2],u[4],col="magenta") points(x,y) On Sat, 2 Sep 2000, Ramon Diaz-Uriarte wrote:> Dear all, > > I am trying to prepare some figures where I'd like the color of the plot region > (i.e., the area bounded by the axes) to be different from the margin area > (i.e., the area of the figure not within the axes region). I can use "bg" but > that changes the background of everything? How can I accomplish what I want? > > Thanks, > > Ramon > > -- > Ramón Díaz-Uriarte > Triana 47 > 28016 Madrid > Spain > > email:ramon-diaz at teleline.es > Phone: +-34-917-730-620 > +-34-657-186-407 > > > > > > > > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- > 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 > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ > >-- 318 Carr Hall bolker at zoo.ufl.edu Zoology Department, University of Florida http://www.zoo.ufl.edu/bolker Box 118525 (ph) 352-392-5697 Gainesville, FL 32611-8525 (fax) 352-392-3704 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
At 11:02 02/09/00 +0000, you wrote:>Dear all, > >I am trying to prepare some figures where I'd like the color of the plotregion>(i.e., the area bounded by the axes) to be different from the margin area >(i.e., the area of the figure not within the axes region). I can use "bg"but>that changes the background of everything? How can I accomplish what I want? > >Thanks, > >Ramon > > -- >Ram?n D?az-Uriarte >Triana 47 >28016 Madrid >Spain > >email:ramon-diaz at teleline.es >Phone: +-34-917-730-620 > +-34-657-186-407Hi, Look at demo(graphics), there are two examples of this. 1. specify the backgroung colour (will colour outside the axes) 2. draw the axes without the plot using plot(..., type="n") 3. draw a rectangle within the axes 4. draw the plot with lines() or points() Best, Emmanuel -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Thank you very much to P. Dalgaard, E. Paradis and B. Bolker for their answers. Basically, the 6th example in demo(graphics) shows how to do it: specify bg, then use par to find boundaries of axes, color that rectangle with rect, and add the points/lines.> x <- rnorm(10) > par(bg= "red") > plot(x, type= "n") > usr <- par("usr") > rct(usr[1], usr[3], usr[2], usr[4], col = "blue") > lines(x, col = "yellow")Ramon **** question **** On Sat, 02 Sep 2000, Ramon Diaz-Uriarte wrote:> Dear all, > > I am trying to prepare some figures where I'd like the color of the plot region > (i.e., the area bounded by the axes) to be different from the margin area > (i.e., the area of the figure not within the axes region). I can use "bg" but > that changes the background of everything? How can I accomplish what I want? > > Thanks, > > Ramon > > -- > Ramón Díaz-Uriarte > Triana 47 > 28016 Madrid > Spain > > email:ramon-diaz at teleline.es > Phone: +-34-917-730-620 > +-34-657-186-407 >-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._