I have the following plot, is there any way in ggplot to display just the numbers 1 to 10 instead of all of them?
Numbers from 10 and after are not so important, but I need to display the ones before. Thank you

My plot

  • 1
    $\begingroup$ the easy fix ( if numbers after 10 are not need) is to filter data to have N from 1 to 10 and plot this data $\endgroup$ – Yaroslaw Homenko Feb 7 '19 at 10:36

I used this kind of wor around, but if you have another solution, please enlighten me :)

df %>%
  ggplot() +
  geom_bar(mapping = aes(x = N%>% as.factor())) +
  xlab(label = 'N') +
  theme(axis.text.x = element_text(angle = 45, size = 8))

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.