2

Help please... I am strugeling to add a trend line in my ggplot. I plotted a decreasing price over several sectors with the price on the y axis and the sectors o the x axis. How can I add the trend line over all sectors?

ggplot(data=data1, aes(x = reorder(sectors, -prices), y = prices)) +
geom_bar(stat = "identity", width = twh/26)+
  geom_label(aes(label = twh2), nudge_y = 10, size = 4) +
  geom_text(aes(label = euros), vjust = 1.5, colour = "white", size = 3)+
  scale_y_continuous(labels = dollar_format(suffix = " €", prefix = ""))+
  labs(title = "Merrit Order Curve Wasserstoff",
   subtitle = "Mengen in TWh und Preise in Euro pro MWh",
   x = "Sektoren", 
   y = "Preise in Euro pro MWh")+
 theme_bw()

0 Answers0