I got stuck in a simple problem.
I have an easy ggplot2 and I just want to extract the y-axis-labels Here is a reproducible Code:
library(ggplot2)
### Create random Data ###
real_xdata <- seq(from=1,to=1000,by=1)
real_ydata <- runif(1000,0,100)
### Create Dataframe for ggplot2 ###
ggplot_data <- data.frame(matrix(NA,
nrow = length(real_xdata),
ncol = 2))
ggplot_data$X1 <- real_xdata
ggplot_data$X2 <- real_ydata
ggplot_one <- ggplot(ggplot_data, aes(x = X1, y = X2)) +
geom_line() +
theme_gray()
print(ggplot_one)
In this case I would need the numbers 0, 25, 50, 75, 100
I tried stuff like
str(ggplot_one)
or
str(ggplot_one$scales)
But have no idea how to proceed.
Any help would be appreciated ! Thanks in advance