难以理解的两个参数plt子地块

2024-09-29 21:36:06 发布

您现在位置:Python中文网/ 问答频道 /正文

我无法理解plt.subplots(2,1, figsize=(10,8))中的两个参数。 2代表两个地块?那么1呢?你知道吗

import matplotlib.pyplot as plt
letter_prop = subtable / subtable.sum().astype(float)
fig, axes = plt.subplots(2,1, figsize=(10,8))
letter_prop['M'].plot(kind = 'bar', rot = 0 , ax=axes[0], title="Male")
letter_prop['F'].plot(kind = 'bar', rot = 0 , ax=axes[1], title="Female", legend = False)

谢谢!你知道吗


Tags: 参数plottitlebarplt代表axletter
1条回答
网友
1楼 · 发布于 2024-09-29 21:36:06

根据documentation,函数的签名是 matplotlib.pyplot.subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True, subplot_kw=None, gridspec_kw=None, **fig_kw)

其中,前两个参数是网格的行数和列数。你知道吗

相关问题 更多 >

    热门问题