[R-SIG-Finance] Plotting 2 option value lines

James jctoll at gmail.com
Tue May 8 06:28:22 CEST 2007


Good morning to you too.  You must be on the other side of the globe,  
since I'm actually thinking about heading off to bed soon.  Thanks  
for your help.  I tried out your suggestion and it works great.   
Thank you.  I also managed to get it to work using:

 > points(x, c2, type="l", col="blue")

Again, thank you, and I'll keep reading Chapter 12 in "An  
Introduction to R".

James


On May 7, 2007, at 10:13 PM, Sean O'Riordain wrote:

> Good morning James,
>
> You need to use lines() for the second "over-plot" with a different
> line type so you'd say something like...
>
> library(fOptions )
> x <- (50:80)
> c1 <- GBSOption(TypeFlag="c", S=x, X=65, Time=1/4, r=.08, b=.08,  
> sigma=.3)@price
> c2 <- GBSOption(TypeFlag="c", S=x, X=65, Time=0.000000001, r=.08,
> b=.08, sigma=.3)@price
> plot(x,c1, type="l")
> lines(x,c2, lty=3)
>
> Then you might add something like...
> legend("top",c("Expiration","3 Months"),lty=c(1,3))
>
> For more information on the basics of plotting have a really slow read
> of section 12 of "An Introduction to R" which should have come with
> your install of R.  Then go through the manual pages for things like
> "lines", "legend", "plot", "plot.default" etc...
>
> On the options pricing question, I'm afraid I can't help you.
>
> Best Regards,
> Sean



More information about the R-SIG-Finance mailing list