NoobKim
NoobKim

Reputation: 21

How to remove the lines and background color in ggplot?

I am using the Palmerpenguins Package. I would like to color my titles in purple, center the main title, include font 14, but most important change the background in white without lines and grey color- I am working with ggplot.

source title at the bottom? how?


ggplot(data = napenguins,  aes(x = species, y = island)) +
  xlab('Soorten pinquïns ')+
  ylab('Eiland')+
  ggtitle('Soorten pinquïns per eiland')+
  
  geom_jitter(aes(color = species),
              width = 0.3,
              alpha = 0.7,
              show.legend = FALSE) +
  scale_color_manual(values = c("#527f85","#7d9cf6","#f08fff"))

plot

Upvotes: 1

Views: 1687

Answers (2)

Gregor Thomas
Gregor Thomas

Reputation: 146224

All the customizations you are asking for can be done in the theme function. This will be a pretty good start:

ggplot(data = napenguins,  aes(x = species, y = island)) +
  xlab('Soorten pinquïns ')+
  ylab('Eiland')+
  ggtitle('Soorten pinquïns per eiland')+
  
  geom_jitter(aes(color = species),
              width = 0.3,
              alpha = 0.7,
              show.legend = FALSE) +
  scale_color_manual(values = c("#527f85","#7d9cf6","#f08fff")) +
  theme_bw(base_size = 14) +
  theme(
    title = element_text(hjust = 0.5),
    axis.title = element_text(color = "purple")
  )

See ?theme for more options (especially the examples at the bottom). Or browse more base themes in the ggthemes package.

Upvotes: 2

TarJae
TarJae

Reputation: 79311

Or you could use theme_void()

ggplot(data = napenguins,  aes(x = species, y = island)) +
  xlab('Soorten pinquïns ')+
  ylab('Eiland')+
  ggtitle('Soorten pinquïns per eiland')+
  
  geom_jitter(aes(color = species),
              width = 0.3,
              alpha = 0.7,
              show.legend = FALSE) +
  scale_color_manual(values = c("#527f85","#7d9cf6","#f08fff")) +
theme_void()

Upvotes: 0

Related Questions