小编phi*_*lka的帖子

ggplot2 multiple stat_smooth:更改颜色和线型

我无法使用多个更平滑的方式更改当前绘图的颜色和线型(stat_smooth())

这里是数据结构的概述:

     serviceInstanceName            timestamp     value
1    DE1Service-utilityPredicted    2014-02-22    10.000000
2    SE1Service-utilityPredicted    2014-02-22     4.385694
3    DE2Service-utilityPredicted    2014-02-22     0.000000
4    US1Service-utilityPredicted    2014-02-22     2.230000
5    DE1Service-utilityActual       2014-02-22    10.000000
6    SE1Service-utilityActual       2014-02-22     8.011919
7    DE2Service-utilityActual       2014-02-22     3.000000
8    US1Service-utilityActual       2014-02-22     1.325191
...
Run Code Online (Sandbox Code Playgroud)

根据时间戳(y轴)和值(x轴),有八个唯一的服务实例.

这里的代码:

ggplot(rmm, aes(x=timestamp, y=value, color=serviceInstanceName, group=serviceInstanceName)) 
+ stat_smooth(size=1.5, method = "loess", level = 0.95, fullrange = TRUE, se = FALSE)
+ scale_x_datetime(breaks = date_breaks("1 day"), labels = date_format("%a/%m"))
+ theme(axis.text.x = element_text(angle = 90, hjust = 1)) + xlab("Day") …
Run Code Online (Sandbox Code Playgroud)

r ggplot2

6
推荐指数
1
解决办法
1万
查看次数

标签 统计

ggplot2 ×1

r ×1