如何在cowplot库下的ggplot中添加框架?

时间:2017-12-01 07:22:57

标签: r ggplot2 border cowplot

最近我开始使用cowplot库。我是情节框架的忠实粉丝,但似乎cowplot不允许它。任何人都知道在cowplot

的情节中创建框架的技巧
library(ggplot2)
library(cowplot)

A <- c(rep(1, times = 3), rep(2, times = 3))
B0 <- c(rep("Text1", times = 3), rep("Text2", times = 3))
B <- factor(B0)
C <- c(0.25, 0.50, 0.75, 8.40, 9.00, 9.60)
D <- c(-7.3, -2.17, 1.05, -3.69, -5.04, -0.746)
DF <- data.frame(A, B, C, D)

ggplot(DF, aes(x = C, y = D , colour = B)) +
  geom_point() + geom_line() + facet_grid(~ B, scales = "free") +
  labs(x = "Axis X", y = "Axis Y") +
  guides(color = guide_legend(expression("R"[0]))) +
  theme(panel.border = element_rect(size = 0.35)) #<- no frame

enter image description here

enter image description here

0 个答案:

没有答案