As I don't have huge number of data points, but enough that they will often overlap and obfuscate other points, I like to use geom_jitter but limit the spread of the data. So I'll often call
... + geom_jitter(width = 0.1, height = 0) and get the desired results. Is there a way to change the default settings though so I don't have to type that every time?
From a bit of googling, I found the
update_geom_defaults function and have used that successfully to change the shape and size of geom_point, but when I try to update the jitter geom, I get an error:
update_geom_defaults("jitter", list(width = 0.1, height = 0)) Error: Can't find `geom` called "jitter"
and indeed, it does seem that when I follow the reply in https://stackoverflow.com/questions/21174625/ggplot-how-to-set-default-color-for-all-geoms to get the defaults for all geoms, jitter does not exist. Is there a reason for this and/or a work around?
Finally, as the title indicates, I'm also having another problem updating the default lineend for geom_line.
ggplot(mtcars, aes(x = disp, mpg)) + geom_line(lineend = "round", size = 5) + facet_grid(. ~ gear)
but this doesn't (the size aesthetic works, but lineend doesn't):
update_geom_defaults("line", list(lineend = "round", size = 5)) ggplot(mtcars, aes(x = disp, mpg)) + geom_line() + facet_grid(. ~ gear)
For what it's worth, I'm using Rstudio 1.2.930, ggplot 3.0.0. Everything else is up to date.
Edit: from looking at the defaults for geom_line, lineend does not exist while size does so maybe that's why when I use
update_geom_defaults with geom_line, I get the results above?