Answer by bmc for Increase number of axis ticks
Additionally, ggplot(dat, aes(x,y)) + geom_point() + scale_x_continuous(breaks = seq(min(dat$x), max(dat$x), by = 0.05)) Works for binned or discrete scaled x-axis data (I.e., rounding not necessary).
View ArticleAnswer by slhck for Increase number of axis ticks
Based on Daniel Krizian's comment, you can also use the pretty_breaks function from the scales library, which is imported automatically: ggplot(dat, aes(x,y)) + geom_point() + scale_x_continuous(breaks...
View ArticleAnswer by crowding for Increase number of axis ticks
You can supply a function argument to scale, and ggplot will use that function to calculate the tick locations. library(ggplot2) dat <- data.frame(x = rnorm(100), y = rnorm(100)) number_ticks <-...
View ArticleAnswer by Chase for Increase number of axis ticks
You can override ggplots default scales by modifying scale_x_continuous and/or scale_y_continuous. For example: library(ggplot2) dat <- data.frame(x = rnorm(100), y = rnorm(100)) ggplot(dat,...
View ArticleIncrease number of axis ticks
I'm generating plots for some data, but the number of ticks is too small, I need more precision on the reading. Is there some way to increase the number of axis ticks in ggplot2? I know I can tell...
View ArticleAnswer by Tung for Increase number of axis ticks
The upcoming version v3.3.0 of ggplot2 will have an option n.breaks to automatically generate breaks for scale_x_continuous and scale_y_continuous devtools::install_github("tidyverse/ggplot2")...
View ArticleAnswer by Saurav Das for Increase number of axis ticks
A reply to this question and How set labels on the X and Y axises by equal intervals in R ggplot?mtcars %>% ggplot(aes(mpg, disp)) + geom_point() + geom_smooth() + scale_y_continuous(limits = c(0,...
View Article