'How do I add the names of the graphs inside the plot in R?
I 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
Solution 1:[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)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Peter |
