如何根据R中的列名绘制行

问题描述 投票:0回答:1

我想绘制一个简单的折线图,该图使用1行和列名作为X轴。

我的数据:

Average 2003-2005 Average 2006-2008 Average 2009-2010 Average 2011-2013 Average 2014-2016
         31.48489          32.53664          30.41938          30.53870          31.15550   
         18.78799           17.78141         17.58791          17.03071          17.25654   
        107.46615          107.71512        109.55090         110.31438         109.66492   

> str(Table_1_2003_2018_All)
'data.frame':   3 obs. of  6 variables:
 $ Average 2003-2005: num  31.5 18.8 107.5
 $ Average 2006-2008: num  32.5 17.8 107.7
 $ Average 2009-2010: num  30.4 17.6 109.6
 $ Average 2011-2013: num  30.5 17 110.3
 $ Average 2014-2016: num  31.2 17.3 109.7
 $ Average 2017-2018: num  31.8 16.8 109.8

我尝试过:

plot(Table_1_2003_2018_All[1,], type="l")

但是我明白了:

Error in plot.default(...) : 
  formal argument "type" matched by multiple actual arguments

提前感谢。

r plot row names
1个回答
0
投票

我们可以先按unlist,然后按plot

plot(unlist(Table_1_2003_2018_All[1,]), type="l")
© www.soinside.com 2019 - 2024. All rights reserved.