[R] reversing perspective plot axis
Greg Snow
Greg.Snow at intermountainmail.org
Wed Oct 31 16:48:26 CET 2007
A simple approach is to swap x and y and rotate the theta parameter -90
degrees (play around with this until it is what you want).
Hope this helps,
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at intermountainmail.org
(801) 408-8111
> -----Original Message-----
> From: r-help-bounces at r-project.org
> [mailto:r-help-bounces at r-project.org] On Behalf Of James
> Sent: Tuesday, October 30, 2007 8:17 PM
> To: r-help at r-project.org
> Subject: [R] reversing perspective plot axis
>
> Hi,
>
> I am trying to create a perspective plot with Time on the
> x-axis, Underlying Price on the y-axis, and Option Price on
> the z-axis. But I don't like the way my x-axis is setup.
> Right now, Time is this sequence.
>
> Time = seq(from = 1/52, to = 1, by=1/52)
>
> That results in the x-axis going from 0 at the back, to 1
> near the foreground corner.(If that makes any sense) I want
> to do the exact opposite. When I try this sequence:
>
> Time = seq(from = 1, to = 1/52, by=-1/52)
>
> I get this error message:
>
> Error in persp.default(x = Time, y = S, z = Price, xlab =
> "Time", ylab = "S", :
> increasing 'x' and 'y' values expected
>
> So it seems that I can't use a descending sequence for my
> perspective plot. Is that true? Is there a way to work around this?
>
> persp(x=Time, y=S, z=Price, xlab="Time", ylab="S", zlab=TypeFlag, ...)
>
> Essentially, what I'm trying to create is something that
> looks like this.
>
> http://www.insightful.com/products/finmetrics/opSensitivity1_lg.gif
>
> You can see how Time on the x-axis diminishes as it moves to
> the foreground corner.
>
> Thanks in advance.
>
> James
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list