davidhodge931 / ggblanket

Simplify ggplot2 visualisation
https://davidhodge931.github.io/ggblanket/
Other
156 stars 8 forks source link

histogram methods for scale don't work #8

Closed davidhodge931 closed 2 years ago

davidhodge931 commented 2 years ago

This occurs because the graph is built using ggplot2 default x/y scales

In histogram, the limits affect the data because in histogram the area between the x_limits affects the size of the y values computed.

image

For all geom's, the build of the ggplot is used to compute the x and y numeric scales. This is because the different positions and stats result in different x and y values.

For gg_histogram, you might have to do something different...

If x is not null, calculate the x_breaks and x_scale based on x_var_vctr, and feed into the ggplot2 build

If y is not null, calculate the y_breaks and y_scale based on the y_var_vctr and feed into the ggplot2

Maybe this should be done in blank??

davidhodge931 commented 2 years ago

If x is not null AND numeric, calculate the x_breaks and x_scale based on x_var_vctr, and feed into the ggplot2 build

If y is not null AND numeric, calculate the y_breaks and y_scale based on the y_var_vctr and feed into the ggplot2

davidhodge931 commented 2 years ago

Now they do :)