0

enter image description here

For a figure like this, how can I make the numbers on the y axis, and the letter descriptions on the x axis become a black font color? (The default color seems to be a faint darkish grey color). I know it sounds simple, but I couldnt find this anywhere online, and any code that I have used does not work.

I am using ggplot() + geom_col() approach to plot my figure.

I would appreciate any help on how to do this. Thank you!

SpiderK
  • 55
  • 6

1 Answers1

1

You can change the colour of text using theme(), e.g.

library(ggplot2)
library(wesanderson)

df <- data.frame(variables = c("a", "b", "c", "d"),
                 values = c(3, 4, 1, 2))

zissou1_palette <- wes_palette(name = "Zissou1", 5)
wes <- c(zissou1_palette[4], zissou1_palette[3], 
         zissou1_palette[2], zissou1_palette[4])
  
ggplot(df, aes(x = variables, y = values, fill = variables)) +
  geom_col() +
  scale_fill_manual(values = wes) +
  theme_grey(base_size = 18) +
  theme(legend.position = "none")

ggplot(df, aes(x = variables, y = values, fill = variables)) +
  geom_col() +
  scale_fill_manual(values = wes) +
  theme_grey(base_size = 18) +
  theme(axis.text = element_text(colour = "black"),
        legend.position = "none")

Created on 2022-03-04 by the reprex package (v2.0.1)

jared_mamrot
  • 22,354
  • 4
  • 21
  • 46