ggeasy
ggeasy copied to clipboard
Tick lines
Tick lines anything... Changing them removing them.
-- https://twitter.com/VizMonkey/status/1202293678364135425?s=20
@DataStrategist
Do you mean add/remove ticks or grid lines? Both would be suitable.
Removing:
library(ggplot2)
ggplot(mtcars, aes(wt, mpg)) +
geom_point() + ggeasy::easy_remove_x_axis(what = "ticks")

Created on 2019-12-06 by the reprex package (v0.3.0)
How would you like to change them? Add more? Rotate?
first of all.....amazing? WTF youre my idol!
So there's 3 things I want to do frequently: Remove everything from both axes (numbers and ticklines), change the heavy interval (to go by 10s or 1s or whatev), and 3, easy rotate them.
While I'm here I might also give you an idea I had and never built. What if we thought of a plot by pieces, so to have a function called y_axis(title, ticks, interval, labels, font, color, angle). And another one for x. The inputs would represent:
- title = the title of the axis. Either
TRUE(would default to whatever it should be),FALSEto omit, or"boom"to override - ticks = T/F
- interval = where should the heavy interval fall?
- labels = T/F
- font = a font override like "Garamond 24"? Maybe allowing size etc in here too? Dunno
- color = replace tick and label color
- angle = text rotation for the angle text
Wouldn't that solve most needs? That way we could have:
ggplot(boom, aes()) + labs() + ggeasy::y_axis() + ggeasy::x_axis()
to handle most customizations (except for color but that's another mess). What do u think?
Remove everything:
library(ggplot2)
ggplot(mtcars, aes(wt, mpg)) +
geom_point() + ggeasy::easy_remove_axes(what = c("ticks", "text", "title"))

Gridlines are on the roadmap, probably an easy_remove_gridlines (see also #31).
Rotate x axis:
library(ggplot2)
ggplot(mtcars, aes(wt, mpg)) +
geom_point() + ggeasy::easy_rotate_x_labels(angle = 45, side = "right")

As for changing the intervals, I'll work on that.
I'll have a think about easy_x_axis and easy_y_axis functions - seems like it could work.
Hi Jon! I was going to open another issue but then realized I had already mentioned about easy-change-intervals.
I also just reread about my idea for x_axis, y_axis... I do think it's kind of cool and might want to build it. Would you appreciate a friendly PR?
I also do understand that it might be confusing to have different grammars in your package. If you don't want that crap in here, no worries I can build it separately.
tick line manipulation is also avail via ggalt
Oh indeed... thanks @yonicd I guess that takes care of the ticks... so only the convo about the x_axis/y-axis functions remain... then this ticket can be closed.