[英]R - Change legend label
I want to change the legend label: instead of the color hex code put "speed", "temp" and "pressure".我想更改图例 label:而不是颜色十六进制代码放入“速度”、“温度”和“压力”。
ggplot(f1, aes(timestamp)) +
geom_point(aes(y=speed, color="#e41a1c")) +
geom_point(aes(y=pressure, color="#377eb8")) +
geom_point(aes(y=temperature, color="#4daf4a"))
you can try this:你可以试试这个:
ggplot(f1, aes(timestamp)) +
geom_point(aes(y=speed, color="speed")) +
geom_point(aes(y=pressure, color="pressure")) +
geom_point(aes(y=temperature, color="temperature"))
to adjust the colours you can do this:要调整颜色,您可以这样做:
ggplot(f1, aes(timestamp)) +
geom_point(aes(y=speed, color="speed")) +
geom_point(aes(y=pressure, color="pressure")) +
geom_point(aes(y=temperature, color="temperature"))+
scale_color_manual("variable", values=c("red", "yellow", "blue")) #or your hex-codes
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.