【发布时间】:2017-04-04 11:27:44
【问题描述】:
我使用的是 python 2.7。
我使用了以下代码并将其应用于我的脚本:http://matplotlib.org/examples/event_handling/data_browser.html
现在,我试图弄清楚它是如何工作的一些具体细节。例如:
fig, (ax, ax2) = plt.subplots(2, 1)
根据我对在 python 中使用逗号的了解,它用于解包。但是在上面的代码中,我无法理解正在解包的内容以及以这种方式解压的原因。是:
fig, (ax, ax2) = plt.subplots(2, 1)
同:
fig, ax, ax2 = plt.subplots(2, 1)
就像 matplotlib faq 中的这段代码一样?:
fig, ax_lst = plt.subplots(2, 2) # a figure with a 2x2 grid of Axes
fig 是否自动等于fig = plt.figure()?
【问题讨论】:
标签: python matplotlib