0

I'm trying to change the y-axis range in my ggplot. The problem is that i've rescaled it before.

ggplot(DichteM, aes(UT, Mittelwert.von.Solidagoscale) )+
geom_point()+
ggtitle("Solidago")+
  theme(plot.title = element_text(hjust = 0.5, size = 12))+
stat_smooth(method = "lm", formula = "y~x", se=FALSE, size = 0.1)+
xlim(c(0,15))+

scale_y_discrete(limits = c("r", "+", "1","2","3","4","5"))+
#ylim(c(2,5))+
ylab("Dichte Braun-Blanquet")+
xlab("Überflutungstage/Jahr")

If I try with ylim( c(2, 5)): it overwrites the scale_y_discrete() function. Ive also tried with scale_y_continuous(limits = c(2, 5)) but it doesnt work out.

here is my plot

Myplot

2
  • Could you please share some reproducible data using dput?
    – Quinten
    Oct 14, 2022 at 15:35
  • Hi @Quinten thanks for your answer! here my example data: DichteM$UT <- c(0,2,14) ; DichteM$Mittelwert.von.Solidagoscale <- c(4.6,4.4,3)
    – Jens77
    Oct 17, 2022 at 12:44

0

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.