On Friday 16 March 2001 20:20, Han Lai wrote:> Hi, > > I am almost new to R. Would any one show me (please include an example) > how to clip a contour or image figure so that I only see the image or > lines inside a selected area?You can use the xlim/ylim parameters (see help(plot.default) ) to specify each axis' start and end value:> x <- 1:50 > y <- 1:50 > z <- outer(x,y) > image(z) > image(z, xlim=c(0.2,0.5)) > image(z, xlim=c(0.2,0.5), ylim=c(0,0.5))The same works with contour(). If you wanted to clip _within_ the graphics area, I'm not sure if or how that would work. HTH Kaspar Pflugshaupt -- Kaspar Pflugshaupt Geobotanical Institute ETH Zurich, Switzerland http://www.geobot.umnw.ethz.ch mailto:pflugshaupt at geobot.umnw.ethz.ch -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Hi, I am almost new to R. Would any one show me (please include an example) how to clip a contour or image figure so that I only see the image or lines inside a selected area? Thank you very much Han -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Han Lai schrieb:> > Hi, > > I am almost new to R. Would any one show me (please include an example) > how to clip a contour or image figure so that I only see the image or > lines inside a selected area?Hi, I had a similar problem some weeks before. My problem was to clip an interpolated (kriged) surface image of a lake to its _irregular_shaped_ shoreline. My solution was some kind of "image manipulation". I "stamped" the shoreline into the image matrix and filled the region outside with the help of the seedfill algorithm, which I implemented as an external shared library (runs as Win32-DLL and .so on Linux). You will need the compiled C library and some R functions. If you or another one who would be interested on my R and C functions, I can give it to you. Maybe it would be worth to create a package with "basic image manipulation procedures" for matrices. If there is anybody, who has a better (or easier) solution, I would be interested too. Thomas Petzoldt -- Thomas Petzoldt (Limnology and Ecological Modelling) Institute for Hydrobiology http://www.tu-dresden.de/fghhihb/ Dresden University of Technology mailto:petzoldt at rcs.urz.tu-dresden.de 01062 Dresden -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._