嘿我是新來的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'。 –