R中的多线图

时间:2018-01-30 19:22:57

标签: r

我有以下类型的数据

Quarter DFT rand
1st 1,61 0.3421256
2nd 1,69 0.3853747
3rd 1,73 1.3841690
2nd 1,79 1.5034130
2nd 1,84 1.6584415
3rd 1,85 2.1692523
3rd 1,85 2.6551129
1st 2,35 2.6630062
3rd 2,43 2.7236042
2nd 2,56 2.8132505
3rd 2,62 2.8572364

我试图在R

中制作一个3线图

X =兰特 y = DFT值 并且行名称将与季度相关

我应该在这里添加什么?

提前谢谢!

1 个答案:

答案 0 :(得分:3)

这是一个ggplot解决方案

library(tidyverse)
d <- read_delim(
"Quarter DFT rand
1st 1,61 0.3421256
2nd 1,69 0.3853747
3rd 1,73 1.3841690
2nd 1,79 1.5034130
2nd 1,84 1.6584415
3rd 1,85 2.1692523
3rd 1,85 2.6551129
1st 2,35 2.6630062
3rd 2,43 2.7236042
2nd 2,56 2.8132505
3rd 2,62 2.8572364",
  delim = " ")

ggplot(d, aes(rand, DFT, color = Quarter)) +
  geom_line()

enter image description here