jonocarroll / ggeasy

ggplot2 shortcuts (transformations made easy)
https://jonocarroll.github.io/ggeasy/
272 stars 21 forks source link

Feature request: more quick functions for removing axis content #76

Open davidhodge931 opened 8 months ago

davidhodge931 commented 8 months ago

I think it'd be super useful to have more quick functions to remove axes content. With the autocomplete, this makes it quicker and easier to add what you want.

It'd also to cool to have a variant for removing the lines and ticks, as this is a common thing to remove both.

Sorry to bombard you with feature ideas!

ggeasy::easy_remove_x_title()
ggeasy::easy_remove_y_title()
ggeasy::easy_remove_axes_title()

ggeasy::easy_remove_x_text()
ggeasy::easy_remove_y_text()
ggeasy::easy_remove_axes_text()

ggeasy::easy_remove_x_axis_line()
ggeasy::easy_remove_y_title()
ggeasy::easy_remove_axes_title()

ggeasy::easy_remove_x_axis_line()
ggeasy::easy_remove_y_line()
ggeasy::easy_remove_axes_line()

ggeasy::easy_remove_x_axis_ticks()
ggeasy::easy_remove_y_ticks()
ggeasy::easy_remove_axes_ticks()

ggeasy::easy_remove_x_axis_line_ticks()
ggeasy::easy_remove_y_line_ticks()
ggeasy::easy_remove_axes_line_ticks()
jonocarroll commented 8 months ago

Cheers. Is the idea here to add some spelled-out aliases for particular arguments?

library(ggplot2)
ggplot(mtcars, aes(wt, mpg)) +
  geom_point() + 
  theme_classic() +
  ggeasy::easy_remove_x_axis(what = c("ticks", "line"))

would use

ggeasy::easy_remove_x_axis_ticks_line()

I'm on the fence on that one. We did add aliases for many of the which = ["x"|"y"] arguments but it relies on the user starting with knowing the axis they want to modify. Autocomplete on the which argument shows the available values (since we have that in the signature) (at least in RStudio).

Part of my hesitation is relying on the argument order to autocomplete - if we want to support arbitrary order then we'd need every permutation. The which argument currently has 4 possible values. Extending those would require extending all the permuatations.

The feature ideas are all great (and most welcome) I just need to find the time to implement them. If you'd like to have a go yourself a PR would be most welcome.

davidhodge931 commented 8 months ago

Hmm, yeah you are prob right re not doing permutations, as many others would be equally valid to do.

What's your feeling on the rest of the proposed functions that would just remove one component of the axes? I think they would be super handy