简体   繁体   中英

In geom_tile(), how to change vertical or horizon border color of the cell

In geom_tile(), how to change vertical or horizon border color of the cell ?

library(tidyverse)
month <- c(1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10)
category <- c("A","B","A","B","A","B","A","B","A","B","A","B","A","B","A","B","A","B","A","B")
sales <- c(10,8,25,21,10,20,25,30,27,8,1,4,9,24,17,6,17,10,5,7)

plot_data <- data.frame(month,category,sales)
plot_data %>% ggplot(aes(x=factor(month),y=category,fill=sales))+
  geom_tile()

在此处输入图像描述

plot_data %>% ggplot(aes(x=factor(month),y=category,fill=sales))+
geom_tile() +
geom_vline(xintercept = 1.5, color = "white") +
geom_vline(xintercept = 2.5, color = "white") +
geom_vline(xintercept = 3.5, color = "white") +
geom_vline(xintercept = 4.5, color = "white") +
geom_vline(xintercept = 5.5, color = "white") +
geom_vline(xintercept = 6.5, color = "white") +
geom_vline(xintercept = 7.5, color = "white") +
geom_vline(xintercept = 8.5, color = "white") +
geom_vline(xintercept = 9.5, color = "white") +
theme(panel.background = element_blank())

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM