user3407156
user3407156

Reputation: 19

Multiple line diagram in R

I have the following kind of data

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

and I am trying to make a 3 line diagram in R

x=rand y=DFT values and the line names would be regarding the quarter

what shall I add here?

Thank you in advance!

Upvotes: 1

Views: 61

Answers (1)

Daniel Anderson
Daniel Anderson

Reputation: 2424

Here's a ggplot solution

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

Upvotes: 3

Related Questions