小编use*_*838的帖子

matplotlib 2d line line,= plot comma含义

我正在浏览matplotlib的基本教程,我正在研究的示例代码是:

import numpy as np

import matplotlib.pylab as plt

x=[1,2,3,4]
y=[5,6,7,8]

line, = plt.plot(x,y,'-')

plt.show()
Run Code Online (Sandbox Code Playgroud)

有没有人知道line(line,=plt.plot(x,y,'-'))之后的逗号是什么意思?我认为这是一个错字,但显然如果我省略逗号,整个代码都不起作用.

python tuples matplotlib line comma

10
推荐指数
2
解决办法
4221
查看次数

标签 统计

comma ×1

line ×1

matplotlib ×1

python ×1

tuples ×1