我正在try 让y-int150和300处的两条水平虚线出现在我的剧情中(S).他们以前出现过,我不知道我做了什么,但他们不再出现了.我没有弄乱代码块本身,所以我想知道我是否删除/更改了情节所依赖的df/包.
# Create labels and limits for week numbers
labels_week_n <- c("W\n1", "W\n2", "W\n3", "W\n4", "W\n5")
limits_week_n <- c(
"Week 15 of 2016", "Week 16 of 2016", "Week 17 of 2016",
"Week 18 of 2016", "Week 19 of 2016"
)
# Weekly_moderate_very plot
# for all 33 participants
weekly_moderate_very_p <-
weekly_data %>%
{
ggplot(.) +
geom_line(
aes(
x = as.factor(week_number),
y = weekly_mod_very_m,
group = id,
color = as.factor(id)
),
linejoin = "mitre",
show.legend = FALSE,
size = .5
) +
geom_point(
aes(
x = as.factor(week_number),
y = weekly_mod_very_m,
group = id,
color = as.factor(id)
),
show.legend = FALSE,
size = 1) +
labs(
title = "Moderate/vigorous activity",
subtitle = "Weekly totals for 33 participants",
y = "Minutes"
) +
scale_x_discrete(
name = NULL,
limits = limits_week_n,
labels = labels_week_n,
expand = c(0, 0)
) +
scale_y_continuous(
breaks = c(0, 150, 300, 450, 600, 750, 900),
limits = c(0, 1060)
) +
scale_color_discrete() +
theme_minimal() +
geom_hline(yintercept = 150, linetype = "dashed") +
geom_hline(yintercept = 300, linetype = "dashed") +
facet_wrap(~id, drop = TRUE, nrow = 3, ncol = 11, scales = "fixed") +
theme(
plot.title = element_text(
margin = margin(5, 5, 5, 0),
size = 14,
hjust = 1,
face = "bold"
),
plot.subtitle = element_text(
margin = margin(1, 5, 5, 0),
size = 10,
hjust = 1,
face = "italic"
),
axis.title.y = element_text(
margin = margin(0, 5, 0, 5),
size = 12
),
panel.spacing.x = unit(.75, "lines")
)
}
weekly_moderate_very_p
这会产生以下结果 plot个
它过go 是这样的,我希望它再次是这样的: plot个
我try 删除/更改线型没有结果,除此之外,我有点不知所措.
SOLVED谢谢大家,我觉得自己太傻了,没有想过要定义线条的 colored颜色 !