繁体   English   中英

R:增加ggplot2中分隔线的大小

[英]R: Increasing size of dividing lines in ggplot2

在此情节中,我必须处理以下问题:

在此处输入图片说明

我想增加正方形之间的白色分隔线的大小。 绘图代码为:

p <- ggplot(long_form_mittelwerte2, aes(Var1, Var2)) + 
  geom_tile(aes(fill = Rang), colour = "white") 

pneu2 <- p + 
  scale_fill_gradient(low = "white", high = "blue", limits= c(1, 3), breaks = c(1, 2, 3)) +
  geom_text(aes(label = mittelwerte_text2$value), size = 12, color = "gray0") +
  theme(axis.title.x = element_blank(),
        axis.title.y = element_blank()) +
  theme(axis.text.y = element_text(size = 30, color = "black"), 
        axis.text.x = element_text(size = 30, color = "black")) +
  scale_y_discrete(labels = c(h_Filter3x3="3x3", h_Filter3x5="3x5", h_Filter3x9="3x9"), 
                   expand = c(0, 0)) +
  scale_x_discrete(expand = c(0, 0)) +
  coord_fixed(ratio = 1) +
  guides(fill= guide_colorbar(barheight = unit(10, "cm"))) +
  theme(legend.text = element_text(size = 30, face = "bold"), 
        legend.title = element_blank())

如果您需要数据,请告诉我。 感谢您的帮助。

您可以在geom_tile设置sizecolour参数,以调整图块之间的空间和颜色:

mtcars %>%
    ggplot(aes(cyl, am, fill = mpg)) + 
    geom_tile(colour = "white", size = 4)

在此处输入图片说明

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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