を構築しているggplot上の特定の(所定のX、Y)ラインをプロットしたい:私は次のコードを持っている私はすでに[R]
library("ggplot2")
strike<-c(44,46,47,48,49,50,51,52,53,54,55,56,
57,58,60,64,46,47,48,49,50,51,52,53,
54,56,58,35,40,44,45,46,48,50,51,52,
53,54,55,56,58,60,70,80,35,40,45,46,
48,50,52,54,56,58,60,70,40,45,50,52,
54,60,70)
optionprice <- c(7.25,7.25,5.1,5.2,4.47,3.45,1.95,2,1.3,
0.8,0.44,0.28,0.14,0.26,0.08,0.25,5.48,
4.35,5.5,4.82,3.25,2.67,2.55,1.9,1.4,
0.85,0.4,18.16,11.31,9.5,7.35,7.05,5.25,
4.2,2.44,2.9,1.6,1.9,1.4,1.15,0.65,0.4,
0.08,0.06,15.7,12.25,8.5,7.6,6.6,5.15,3.9,
2.85,1.95,1.45,1.1,0.22,12.65,8.5,
5.07,4.3,3.55,1.63,0.44)
Expiration <- c('2017-10-20','2017-10-20','2017-10-20','2017-10-20',
'2017-10-20','2017-10-20','2017-10-20','2017-10-20',
'2017-10-20','2017-10-20','2017-10-20','2017-10-20',
'2017-10-20','2017-10-20','2017-10-20','2017-10-20',
'2017-11-17','2017-11-17','2017-11-17','2017-11-17',
'2017-11-17','2017-11-17','2017-11-17','2017-11-17',
'2017-11-17','2017-11-17','2017-11-17',
'2017-12-15','2017-12-15','2017-12-15',
'2017-12-15','2017-12-15','2017-12-15',
'2017-12-15','2017-12-15','2017-12-15',
'2017-12-15','2017-12-15','2017-12-15',
'2017-12-15','2017-12-15','2017-12-15',
'2017-12-15','2017-12-15',
'2018-03-16', '2018-03-16', '2018-03-16', '2018-03-16', '2018-03-16', '2018-03-16',
'2018-03-16', '2018-03-16', '2018-03-16', '2018-03-16', '2018-03-16', '2018-03-16',
'2018-06-15', '2018-06-15', '2018-06-15', '2018-06-15', '2018-06-15', '2018-06-15',
'2018-06-15')
Philips <- data.frame(strike, optionprice, as.factor(Expiration))
IrisPlot.shape <- ggplot(Philips, aes(strike, optionprice, shape =
Expiration, colour = Expiration))+ geom_point(size = 4)+labs(x =
"Strike/Exercise price")+labs(y = "Option Price")
print(IrisPlot.shape + scale_shape_manual(values = c(15, 16,
17,18,19)) + scale_colour_manual(values = c("chartreuse4",
"chocolate", "slateblue4","black","purple")))
を、私は、このプロットに追加したいですそれぞれxを有する特定の行、yの値:ペイオフ:
striking=seq(10, 53.49, length.out=63)
calling=53.49-striking
Iは最初のプロットとも言うであろう凡例に含まれる行を希望。このプロットの写真を添付して、私が何をしているのかを見てみましょう。前もって感謝します。
this is the figure I have created
@Axeman私はデータを提供したばかりです。コメントありがとう。 –