1

If a have a data frame that has columns names of:

x   y1   y2   y3

and I want a line plot with 3 different colored lines, y1, y2 and y3 plotted against x, how do I do this with ggplot and how do I add a legend that has the column names with their corresponding colors?

1
  • 3
    What have you tried, what are the coding problems you are experiencing? Please make your question reproducible minimal reproducible example: paste a sample of your data into the question with dput(your_df). Consider putting the data into long format using tidyr::pivot_longer() Commented Jul 13, 2021 at 19:34

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.