python - distplot() 得到了一个意外的关键字参数 'figsize'

标签 python pandas matplotlib seaborn

<分区>

我正在尝试更改正在构建的直方图的图形大小。 我收到错误:

distplot() got an unexpected keyword argument 'figsize'

我尝试运行的代码是这样的:

sns.distplot(MSoft['pct_change'].dropna(), bins=100, color='magenta', figsize=(20,8))

最佳答案

您需要更改图形的大小,在其上绘制图 -

sns.set_style('ticks')
fig, ax = plt.subplots()
fig.set_size_inches(10, 6)
sns.distplot(MSoft['pct_change'].dropna(), bins=100, color='magenta', ax=ax)

关于python - distplot() 得到了一个意外的关键字参数 'figsize',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49572582/

相关文章:

python - matplotlib 为单个散点图添加具有多个条目的图例

python - 如何在 Python 中进行实时 3D 绘图

Python,在带有 pandas DataFrame 的 "order by"中使用 "group concat"

java - 经过 K 次尝试后,数字 N 减少为非正值的概率

python - Pandas DataFrame 按日期移动列以创建滞后值

python - k=1 的最近邻距离(以时间为单位)

python - py.test 未启动(EBUSY : [Resource device])

python - 数组窗口上 pandas rolling_std 和 np.std 的区别

python - 在 python 中的下划线处拆分并存储第一个值

python - Matplotlib:分段常数函数的 bar/bin 样式图