Closed
Description
Right now the documentation for geom_contour()
and friends states that the bin
argument is overridden by the binwidth
parameter. However, this seems not to be the case.
library(ggplot2)
v <- ggplot(faithfuld, aes(waiting, eruptions, z = density))
# Defining bins
v + geom_contour(bins = 5)
# Defining binwidth
v + geom_contour(binwidth = 0.001)
# Defining both. Per documentation, binwidth should
# take precedence and this should be the same as the second plot
v + geom_contour(binwidth = 0.001, bins = 5)
Created on 2021-10-28 by the reprex package (v2.0.0)
The issue lays on the contour_breaks()
function, which computes the binwidth from the bins if bins is not NULL:
Lines 158 to 170 in 759c63c
I believe that previous versions of geom_contour()
did respect the documentation. Should the documentation be changed to reflect the new precedence or should the code be changed to reflect the documentation?
Metadata
Metadata
Assignees
Labels
No labels