I made this plot with the following code:
A %>%
drop_na(Roadgroup) %>%
drop_na(L.Share) %>%
filter(L.Share != "#DIV/0!") %>%
ggplot(aes(x=LP.share, y=L.Share, colour=Ward)) +
geom_point()
How would I go about making the y axis labels match the format of the x axis? (with both 2 decimal places, and less densely cluttered)
You can specify this with a function inside scale_y_continuous
with the breaks
argument:
A %>%
drop_na(Roadgroup) %>%
drop_na(L.Share) %>%
filter(L.Share != "#DIV/0!") %>%
ggplot(aes(x=LP.share, y=L.Share, colour=Ward)) +
geom_point() +
scale_y_continuous(breaks = function(y) seq(floor(min(y, digits = 1)),
ceiling(max(y, digits = 1)),
by = 0.05))
You may need to modify my function(y)
here to fit your needs (by changing digits
, and by
). However, if A$L.Share
is a factor, you will need to convert this to a numeric in order for scale_y_continuous
to work properly.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.