Description
The example "Orientation follows the discrete axis" in stat_summary (lines 55 to 58) doesn't demonstrate what it claims to after the ggplot2 update to v3.3.2 (it did work in 3.3.0). The example doesn't actually follow the discrete axis. In order for it to demonstrate what it claims to, cyl should be replaced with factor(cyl) or a similar discrete datatype. See details below.
# install / load ggplot2 v 3.3.0
# run below example
# Orientation follows the discrete axis
ggplot(mtcars, aes(mpg, cyl)) +
geom_point() +
stat_summary(fun.data = "mean_cl_boot", colour = "red", size = 2)
You will get a plot that summarizes mpg by groups of cyl, this is the presumed desired behavior based on the title of the example
# install / load ggplot2 v 3.3.2
# run below example
# Orientation follows the discrete axis
ggplot(mtcars, aes(mpg, cyl)) +
geom_point() +
stat_summary(fun.data = "mean_cl_boot", colour = "red", size = 2)
Now you will get a plot that summarizes cyl by mpg,
but this doesn't match the behavior implied by the title for the example "Orientation follows the discrete axis"
In order for this example to work with v 3.3.2, the y-mapped variable has to result in a mapped_discrete datatype
For example, you could update the example as follows (replacing cyl with factor(cyl)):
# Orientation follows the discrete axis
ggplot(mtcars, aes(mpg, factor(cyl))) +
geom_point() +
stat_summary(fun.data = "mean_cl_boot", colour = "red", size = 2)