Open alex-gable opened 2 years ago
Instead of calling continuous_scale, scale_*_gradient_{theme} should call the appropriate ggplot2::scale_*_gradient function.
continuous_scale
scale_*_gradient_{theme}
ggplot2::scale_*_gradient
for example, ggplot::scale_fill_gradient2() includes the midpoint argument (and default), which it passes to continuous_scale()'s rescaler..
ggplot::scale_fill_gradient2()
continuous_scale()
rescaler
> scale_fill_gradient2 function (..., low = muted("red"), mid = "white", high = muted("blue"), midpoint = 0, space = "Lab", na.value = "grey50", guide = "colourbar", aesthetics = "fill") { continuous_scale(aesthetics, "gradient2", div_gradient_pal(low, mid, high, space), na.value = na.value, guide = guide, ..., rescaler = mid_rescaler(mid = midpoint)) }
this is very similar to - and possibly redundant with - what I see in scale_fill_gradient2_tableau()
scale_fill_gradient2_tableau()
> ggthemes::scale_fill_gradient2_tableau function (palette = "Orange-Blue Diverging", ..., na.value = "grey50", guide = "colourbar") { continuous_scale("fill", "tableau2", tableau_div_gradient_pal(palette), na.value = na.value, guide = guide, ...) }
while this same functionality could be implemented in manually, it seems to me to be more appropriate and intuitive that a function like scale_fill_gradient2_tableau would extend scale_fill_gradient2 which extends continuous_scale
scale_fill_gradient2_tableau
scale_fill_gradient2
Instead of calling
continuous_scale
,scale_*_gradient_{theme}
should call the appropriateggplot2::scale_*_gradient
function.for example,
ggplot::scale_fill_gradient2()
includes the midpoint argument (and default), which it passes tocontinuous_scale()
'srescaler
..this is very similar to - and possibly redundant with - what I see in
scale_fill_gradient2_tableau()
while this same functionality could be implemented in manually, it seems to me to be more appropriate and intuitive that a function like
scale_fill_gradient2_tableau
would extendscale_fill_gradient2
which extendscontinuous_scale