I am currently trying to produce some graphs using geom_step()
. Here is my code:
ggplot(usage_data,aes(x = to_regulate_up)) +
theme_minimal() +
geom_step(aes(y = 1 - after_stat(y)), stat = "ecdf", linewidth=0.5, color="black") +
scale_y_continuous(labels = percent_format()) +
labs(title = "1 - CDF of used aFRR capacity", x="Used capacity", y="Probability")
When i the output of this plot into an RShiny Application via ggplotly i get what i expected:
When trying to save the plot to a svg (ggsave(file="/tmp/curve2.svg", plot=plot, width=8, height=4)
or when plotting the same thing in RStudio i however get the following result:
As in the curve starts at 100% and then drops down, which is not what i want.
I already tried setting different xlim
parameters to make the curve start more to the right but still got the same result.
Thanks for any insight to what might be the problem.
P.S. i dont really think it has anything to do with exporting the plot to a svg, because in the RStudio Plot pane it also looks the same.