0

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

Henrik
  • 65,555
  • 14
  • 143
  • 159
ValentinDarting
  • 117
  • 2
  • 11
  • Okay thanks a lot,that worked. can i delete the thread or will it be deleted? – ValentinDarting Jul 16 '15 at 11:54
  • 1
    No, you don't have to delete it. See e.g. [here](http://meta.stackexchange.com/questions/132600/should-i-delete-my-answer-to-a-question-thats-marked-as-a-duplicate). If someone searches for an answer and uses search terms which direct them to _your_ question (and _not_ the other Q&A), your post will be helpful in guiding them to the answer. – Henrik Jul 16 '15 at 12:01

0 Answers0