MatthewBJane / ThemePark

Fun ggplot themes for popular culture
http://matthewbjane.com/ThemePark/
MIT License
196 stars 13 forks source link

Apple theme #9

Open danielhe3 opened 1 year ago

danielhe3 commented 1 year ago

Submitting a theme based on Apple's keynote: https://www.apple.com/newsroom/2021/10/introducing-m1-pro-and-m1-max-the-most-powerful-chips-apple-has-ever-built/

It may be slightly boring and too close to theme_bw(), however, so I understand if it doesn't make the cut 👍

lcpilling commented 1 year ago

Hi. I actually really like the theme. I guess this is unique as you could use it in a work context and people wouldn't necessarily know it is pop culture (is an Apple theme pop culture?)

Before we accept. We have had several discussions over the last days about how to make the submissions syntax more consistent between the themes, and also more versatile for users. Christopher Kenny has provided a theme (Finding Nemo) which includes more fill scales for discreet, etc., and so we've updated the template to utilize this. It also prompts contributors to document the functions for when they are packaged up properly.

Would you consider updating your themes to use the new template? Hopefully not much work :)

https://github.com/MatthewBJane/theme_park/blob/main/theme_template.R

Thanks! Luke

danielhe3 commented 1 year ago

Hi Luke, absolutely I can look into this. Agree that the template is really helpful to keep things consistent!

Daniel

danielhe3 commented 1 year ago

Hi Luke, sorry it took so long but I copied the new template and modified it to fit the theme. Let me know if I need to change anything.

lcpilling commented 1 year ago

Thanks Daniel! No apology necessary... this is just a hobby project for everyone. I have a three suggestions.

First, the background of the plots on (https://www.apple.com/newsroom/2021/10/introducing-m1-pro-and-m1-max-the-most-powerful-chips-apple-has-ever-built/) are #F7F7F7 rather than completely white, the text colour is ~ #888888 and the axis is #484848 (I think).


apple_theme_colors <- c(
  background = '#F7F7F7',
  text       = '#888888',
  axis       = '#484848'
)

ggplot(data = data.frame(x = rnorm(50, 0, 1), y = rnorm(50,0,1)), aes(x = x, y = y)) +
  geom_point() + 
  geom_smooth(method = 'lm') +
  labs(title="Apple scatter", subtitle="Theme by Daniel", caption="Data from rnorm()",
       x="Random variable X", y="Random variable Y") +
  theme_apple()

image

Second, the other themes included in the package include more colours in the theme colors object, such as light, medium and dark which helps users quickly access a few useful colours. Going off the purple line from the link, you could add the following?

apple_theme_colors <- c(
  background = '#F7F7F7',
  text       = '#888888',
  axis       = '#484848',
  light      = '#CBA5FC',
  medium     = '#A766FF',
  dark       = '#6501FF'
)

So people can do something like:

ggplot(data = data.frame(x = rnorm(50, 0, 1), y = rnorm(50,0,1)), aes(x = x, y = y)) +
  geom_point(color = apple_theme_colors["medium"]) + 
  geom_smooth(method = 'lm',
              color = apple_theme_colors["dark"], 
              fill = apple_theme_colors["light"]) +
  labs(title="Apple scatter", subtitle="Theme by Daniel") +
  theme_apple()

image

Third! Remove the axis ticks from the theme - again to be more similar to the plot you linked to:

ggplot(data = data.frame(x = rnorm(50, 0, 1), y = rnorm(50,0,1)), aes(x = x, y = y)) +
  geom_point(color = apple_theme_colors["medium"]) + 
  geom_smooth(method = 'lm',
              color = apple_theme_colors["dark"], 
              fill = apple_theme_colors["light"]) +
  labs(title="Apple scatter", subtitle="Theme by Daniel", caption="Data from rnorm()",
       x="Random variable X", y="Random variable Y") +
  theme_apple() +
  theme(axis.ticks = element_blank())

image