library
(ggplot2)
set.seed
(123)
dates <-
seq
(
as.Date
(
"2023-01-01"
),
as.Date
(
"2023-01-31"
), by =
"days"
)
prices <-
cumsum
(
runif
(
length
(dates), min = -2, max = 2))
stock_data <-
data.frame
(date = dates, price = prices)
ggplot
(stock_data,
aes
(x = date, y = price)) +
geom_step
(direction =
"hv"
, color =
"#0072B2"
,
size = 1.2, linetype =
"solid"
) +
theme_minimal
() +
labs
(
title =
"Hypothetical Stock Price Movement"
,
x =
"Date"
,
y =
"Price"
,
caption =
"Source: Example Stock Data"
) +
geom_vline
(xintercept =
as.Date
(
c
(
"2023-01-05"
,
"2023-01-15"
)),
linetype =
"dashed"
, color =
"red"
) +
geom_text
(
aes
(x =
as.Date
(
"2023-01-05"
), y =
max
(stock_data$price),
label =
"Earnings Report"
), hjust = 1.1, vjust = -0.5,
color =
"red"
) +
geom_text
(
aes
(x =
as.Date
(
"2023-01-15"
), y =
max
(stock_data$price),
label =
"Product Launch"
), hjust = -0.1, vjust = -0.5,
color =
"red"
)