From 2b00a351c0b5aae1ecee9e62684f02f6de44a7c5 Mon Sep 17 00:00:00 2001 From: Arthur DANJOU Date: Thu, 13 Nov 2025 16:37:18 +0100 Subject: [PATCH] Limit plots to single series: show only Call in first plot and only Put in second; remove unused series and adjust data frames. --- .../tp3/sh-black_scholes/app-enonce.R | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/M2/Data Visualisation/tp3/sh-black_scholes/app-enonce.R b/M2/Data Visualisation/tp3/sh-black_scholes/app-enonce.R index 9b5979e..57c2b34 100644 --- a/M2/Data Visualisation/tp3/sh-black_scholes/app-enonce.R +++ b/M2/Data Visualisation/tp3/sh-black_scholes/app-enonce.R @@ -51,12 +51,10 @@ server <- function(input, output) { strikes = seq(K - 30, K + 30) vcall = sapply(strikes, function(k) BS(S, k, T, v, rf, dv)[1]) - vput = sapply(strikes, function(k) BS(S, k, T, v, rf, dv)[2]) - df = data.frame(strikes = strikes, Call = vcall, Put = vput) + df = data.frame(strikes = strikes, Call = vcall) p <- ggplot(df, aes(x = strikes)) + geom_line(aes(y = Call, color = "Call")) + - geom_line(aes(y = Put, color = "Put")) + labs(title = "Black-Scholes Option Pricing", x = "Strike Price", y = "Option Price") + @@ -75,13 +73,11 @@ server <- function(input, output) { dv = input$divrate strikes = seq(K - 30, K + 30) - vcall = sapply(strikes, function(k) BS(S, k, T, v, rf, dv)[1]) vput = sapply(strikes, function(k) BS(S, k, T, v, rf, dv)[2]) - df = data.frame(strikes = strikes, Call = vcall, Put = vput) + df = data.frame(strikes = strikes, Put = vput) p <- ggplot(df, aes(x = strikes)) + - geom_line(aes(y = Put, color = "Put")) + - geom_line(aes(y = Call, color = "Call")) + + geom_line(aes(y = Put, color = "Put")) + labs(title = "Black-Scholes Option Pricing", x = "Strike Price", y = "Option Price") +