0

I'm fairly new to R and am trying to learn how to do some plotting with it. I managed to read in multiple csv files I have from some code analysis (7 of them), and melt them together as shown in the picture, but I'm not sure what I need to do to plot it correctly. The graph is giving me one combined line instead of multiple. How do I fix this? The line I ran to plot the graph is shown in the image, but in case it's too small I ran ggplot(melted, aes(data_size, time_ms, colour=L1)) + geom_line()

Thanks in advance!

ggplot 2 result

2
  • I'm not very familiar with R myself, but isn't melting your issue? That is combining the CSVs into a single data stream, hence the one graph. Commented Feb 19, 2017 at 6:16
  • add group = L1 as aesthetic, or make it a discrete variable with colour = as.factor(L1) Commented Feb 19, 2017 at 6:17

1 Answer 1

1

If you check the class of your L1 column, it's going to come back as "numeric". If you'd like to have all of the lines in the same space, ggplot(melted, aes(data_size, time_ms)) + geom_line(aes(colour = factor(L1))) will do the trick.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you SO MUCH!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.