嘿我是新来的R和有一个非常小的问题多变量的情节,线条样式和厚度,黑色和白色
我有以下数据集:
head(risk_free_rate_comparison)
Dates ` Swap rate` `Sovereign bond yield rate` `Swap rate - Sovereign bond yield rate`
<dttm> <dbl> <dbl> <dbl>
1 2007-01-02 408.9 380.9568 27.9432
2 2007-01-03 410.3 380.4535 29.8465
3 2007-01-04 409.2 381.3993 27.8007
4 2007-01-05 414.3 385.0663 29.2337
5 2007-01-08 413.1 384.2545 28.8455
6 2007-01-09 415.5 384.9770 30.5230
,具有以下剧情:
ggplot(d, aes(Dates, value, color = variable, linetype = variable)) +
+ geom_line() +
+ labs(color = NULL, linetype = NULL) +
+ theme_classic() +
+ theme(legend.position = "bottom") +
+ ylab("Rates in bp")
+ theme(
+ legend.position = "bottom",
+ legend.direction = "vertical",
+ legend.box.margin = margin(t = 20),
+ axis.title.x = element_text(margin = margin(t = 20)),
+ axis.title.y = element_text(margin = margin(r = 20))
+)
现在我想改变黑色和白色风格的三个变量的线条颜色。为了能够区分线条,也许可以改变线条粗细或以某种方式进行。
您可以使用'scale_colour_manual()','scale_linetype_manual()','scale_size_manual()'手动更改线条颜色,线宽和线型。你没有提供一个可重复的例子,所以看看例如例如'?scale_colour_manual'。 –