我希望绘制计数与国家线图并添加颜色作为变体类型。但是下面代码的输出不是我们想要的。
另外,如何将我的 x-ticks 旋转 90 度?
谢谢
library(tidyverse)
countries <- c("America", "Brazil", "Canada", "America", "Brazil", "Canada")
count <- c(1, 2, 3, 2.5, 3, 4.5)
variant_type <- c("A", "A", "A", "B", "B", "B")
tbl <- tibble(countries, count, variant_type)
ggplot(data = tbl,
aes(x = countries,
y = count),
color = variant_type) +
geom_line() +
theme_bw() +
theme(legend.position = "bottom",
aspect.ratio = 3)