Python 和 R语言 中的折线图

Posted 百里希文

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Python 和 R语言 中的折线图相关的知识,希望对你有一定的参考价值。

1、用 R 的基础图形系统

 x <- c(21, 33, 42, 46, 60)
 y <- c(16, 20, 27, 41, 61)
 
plot(x, y, type=\'b\')

 

2 matplotlib 库

import matplotlib.pyplot as plt 

x = [21, 33, 42, 46, 60]
y = [16, 20, 27, 41, 61]

plt.plot(x, y, marker=\'o\', ls=\'--\', c=\'k\')
plt.xlabel(\'x\')
plt.ylabel(\'y\')

plt.show()

 

 

按语:

R 可以自动给出坐标轴标题。

以上是关于Python 和 R语言 中的折线图的主要内容,如果未能解决你的问题,请参考以下文章