ggeasy icon indicating copy to clipboard operation
ggeasy copied to clipboard

Tick lines

Open jonocarroll opened this issue 5 years ago • 6 comments

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.

jonocarroll avatar Dec 06 '19 07:12 jonocarroll

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?

jonocarroll avatar Dec 06 '19 08:12 jonocarroll

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), FALSE to 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?

DataStrategist avatar Dec 06 '19 15:12 DataStrategist

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.

jonocarroll avatar Dec 07 '19 02:12 jonocarroll

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.

DataStrategist avatar Apr 14 '20 10:04 DataStrategist

tick line manipulation is also avail via ggalt

yonicd avatar Apr 14 '20 10:04 yonicd

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.

DataStrategist avatar Apr 14 '20 13:04 DataStrategist