[R] behaviour of plot() when coord. are out of range
Marcus Eger
marcus.eger at physik.uni-marburg.de
Wed Sep 27 12:52:11 CEST 2000
Uwe Ligges wrote:
>
> Marcus Eger wrote:
> >
> > Dear all,
> >
> > a question concerning the plot range. When I plot
> > at first with linear coordinates, a subsequent polygon() call produces
> > a figure that I expect. However, when I apply a logarithmic scale,
> > two polygons appear. Is it possible to override this behaviour?
> >
> >
> In your case, the fifth y value is ommitted, so polygone cannot work as
> you are expecting.
> The following should work:
>
> y <- c(1.84147098480790, 1.90929742682568, 1.14112000805987,
> 0.243197504692072, -0.958924274663133,0.720584501801074,
> 1.65698659871879, 1.98935824662338, 1.41211848524176,0.45597888911063)
>
> plot(y,ylim=c(0.0000000001,2),type="l",log="y")
>
> x <- 1:10
> temp <- which(y<0)
> polygon(x[-temp], y[-temp], col="red")
>
> Uwe Ligges
Yes it works... now only one polygon appears. However, in the linear
plot (log="")
the drawn lines are extrapolated until they reach the plot boundary,
i.e. the polygon
polygon(x, y, col="red") is clipped by the boundary.
On the other hand, using log="" this extrapolation is not done because
the negative
value is omitted. I actually wished this value would not just be
omitted.
It could simply lie outside the range - and thus, there could be a
vertical extrapolation
line indicating it.
The whole thing is important for me because I want to fill the area
below the curve.
Marcus Eger
--
+-------------------------------------------------------
| Marcus Eger
| Philipps Universitaet Marburg
| Fachbereich Physik AG Neurophysik
| Renthof 7
| 35032 Marburg
| Tel. +49 6421 282-4169
| Fax +49 6421 282-7034
+-------------------------------------------------------
| E-Mail: marcus.eger at physik.uni-marburg.de
+-------------------------------------------------------
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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