jonocarroll / ggeasy

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

Easy text adjustments #34

Closed jonocarroll closed 4 years ago

jonocarroll commented 4 years ago

Text attribute adjustment:

Common (?) use-case shortcuts:


Any other suggestions @bhive01?

bhive01 commented 4 years ago

I'm sorry I didn't respond to your initial posting. What I was thinking about on Twitter was when I'm prepping a figure for a presentation and I just want to bump up the base_size so that everything gets bigger together. At least I think that's how it works, every time I try and do it I have to look it up. I think it's base_size that way everything else scales from there. I've looked very briefly here: https://github.com/jonocarroll/ggeasy/blob/feature/text_size/R/text.R and it didn't look like you were using base size, but perhaps you've got it covered with rel or something?

jonocarroll commented 4 years ago

This PR lets you set the size for each component (or all of them) explicitly. It looks like base_size = 11 for most themes. I could add a shortcut to modify base_size if you think there's some relative scaling involved.

jonocarroll commented 4 years ago

For p1 <- ggplot(mtcars, aes(hp, mpg)) + geom_point(),

p1 + theme_grey(base_size = 15)

and

p1 + theme_grey() + easy_change_text(c("text", "title"), "size", 15)

appear to give the same results visually, with some odd scaling happening.

I can work on getting my functions to be more consistent with that output.

jonocarroll commented 4 years ago

It looks like the theme_* functions accept a base_size argument then pass that on to the individual components (with various rel components). That means it doesn't generalise outside of an individual theme. The implementation I have will allow you to specify some or all of the specific sizes.

codecov[bot] commented 4 years ago

Codecov Report

Merging #34 into master will not change coverage. The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #34   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           5      5           
  Lines         138    179   +41     
=====================================
+ Hits          138    179   +41
Impacted Files Coverage Δ
R/legend.R 100% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 286db5f...80c5fc3. Read the comment docs.

jonocarroll commented 4 years ago

Ready to merge but I'll let it steep for a few days. Feel free to comment if you spot anything.

@bhive01 @yonicd