R ggplot2 scale_y_continuous : Combining breaks & limits

As JasonAizkalns commented your problem can’t be solved without n reproducible example. The code below does what you want on the iris data and should work for your example as well.

library(ggplot2)

df <- iris


## all data, default breaks
ggplot(df, aes(Sepal.Length, Sepal.Width)) +
  geom_point()

## subset of data is seen in plot, breaks changed
ggplot(df, aes(Sepal.Length, Sepal.Width)) +
  geom_point() + 
  scale_x_continuous(breaks = c(5.5,6.5), limits = c(5,7)) +
  scale_y_continuous(breaks = c(3.5,2.5), limits = c(2,4))

Leave a Comment

tech