1
votes

I am trying to plot data with a classic look and black axis labels. Yet, theme_classic has two different shades of grey for the axis tick labels and the ticks.

Using the mtcars dataset and p1 as listed in ?theme_classic I tried

 p1 + theme_classic(axis.text.x = element_text(colour="black"))

but this just works with theme not theme_classic.

Is there a way to get black axis ticks and labels without having to specify a classic theme from scratch?

1
I'd try axis.ticks = element_line(color = "black")Gregor Thomas
I think you have to do p1 + theme_classic() + theme(axis.text.x = element_text(colour="black"))Gallarus

1 Answers

3
votes

You need to add customizations to theme() calls after theme_classic(). Try:

p1 + theme_classic() +
  theme(
    axis.text.x = element_text(color="black"),
    axis.ticks = element_line(color = "black")
  )

The only arguments theme_***() functions typically take are base size and family related arguments. Additional customization is done through plain theme().