1

I'm going to be producing a lot of visuals for a report. My boss really likes the theme_clean() horizontal lines but wants me to add the same lines to the x-axis. Is there an easy way to do this?

Here is my code

library(ggplot2)
library(ggthemes)

ggplot(mtcars, aes(x = mpg)) + 
  geom_point(aes(y = hp)) + 
  theme_clean(base_size=18)

enter image description here

How can I get the same style for my x-axis ticks (going vertical).

Best.

Gregor Thomas
  • 136,190
  • 20
  • 167
  • 294
RL_Pug
  • 697
  • 7
  • 30

1 Answers1

2

Try this. Simply typing theme_clean into the console shows you the default values used by theme_clean for panel.grid.major.y which we then can use to set the values for panel.grid.major.x accordingly using theme():

library(ggplot2)
library(ggthemes)

ggplot(mtcars, aes(x = mpg)) + 
  geom_point(aes(y = hp)) + 
  theme_clean(base_size=18) + 
  theme(panel.grid.major.x = element_line(colour = "gray", linetype = "dotted"))

Created on 2020-04-07 by the reprex package (v0.3.0)

stefan
  • 90,330
  • 6
  • 25
  • 51