我正在用ggplot
来制作一个三面板人物.我想按州列出facet_wrap
并在标签中包含城市名称,但是,当我这样做时,州和城市名称之间会出现一条水平线.如何删除水平线?
library(tidyverse)
set.seed(333)
# Example dataset
df <- data.frame(
state = c("North Carolina","North Carolina","North Carolina",
"North Carolina","North Carolina","North Carolina",
"Virginia","Virginia","Virginia"),
city = c("Boone","Boone","Boone",
"Elizabeth City","Elizabeth City","Elizabeth City",
"Norfolk","Norfolk","Norfolk"),
year = rep(seq(2000,2004,2),3),
value = round(rnorm(9,100,50))
)
# Example plot (how can I remove the horizontal line between the state and city labels?)
df %>%
ggplot(aes(x = year, y = value)) +
geom_point() +
theme_bw() +
facet_wrap(~state+city)
创建于2024年4月19日,共有reprex v2.1.0个