-2

enter image description hereI built the graph but I try to add the names of the graphs and it does not work. It should look like in the picture, I only have the graphs without the names

I would happy if anyone knows which function should be used

1 Answers1

1

The geomtextpath package looks as if it is ideal for this use case. Very nice it is too.

library(ggplot2)
library(geomtextpath)


ggplot(data.frame(x = 0)) +
  geom_textpath(stat = "function", fun = ~ 2.5 * .x,
                label = "Holding Cost",
                vjust = 1.1, colour = "green", hjust = 0.95, size = 6) +
  geom_textpath(stat = "function", fun = ~ 500 / .x ^0.5,
                label = "Set Up Cost",
                vjust = -0.1, colour = "blue", hjust = 0.95, size = 6) +
  geom_textpath(stat = "function", fun = ~ 500 / .x ^0.5 + 2.5 * .x,
                label = "Total Cost",
                vjust = -0.1, colour = "red", hjust = 0.95, size = 6) +
  xlim(1, 100)+
  theme_bw()

Created on 2022-03-24 by the reprex package (v2.0.1)

Peter
  • 11,500
  • 5
  • 21
  • 31