[英]R - Plot multiple columns as years on x-axis, plot rows as different lines
Here's my data frame: 这是我的数据框:
2010 2011 2012 2013 2014 2015
A 0 100 164 75 154 110
B 71 77 136 58 138 136
C 0 0 132 53 83 0
I'd like to make a line graph in which the years are plotted along the x-axis and and counts are plotted along the y-axis, with rows A, B, and C each having their own line. 我想制作一个折线图,其中沿x轴绘制年份,沿y轴绘制计数,行A,B和C都有各自的线。 Is it possible to do this without melting the years into a single variable? 是否可以在不将年份融合为一个变量的情况下做到这一点?
There is a function for this, matplot
. 有一个功能matplot
。 Try 尝试
matplot(yourData, type="l")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.