当前位置:   article > 正文

matplotlib设置分辨率_matplotlib x分辨率

matplotlib x分辨率

问题描述

绘制贝塔分布的时候感觉太小看不清

import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
%matplotlib inline

x = np.linspace(0, 1, 100)
labels = []
a_list, b_list = [0.5, 5, 1, 2, 2], [0.5, 1, 3, 2, 5]
for a, b in zip(a_list, b_list):
    labels.append('α={}, β={}'.format(a, b))
    y = stats.beta(a=a, b=b).pdf(x)
    plt.axis([0, 1.0, 0, 2.5])
    plt.tick_params(axis='both', labelsize=14)
    plt.plot(x, y)
plt.plot()
plt.legend(labels=labels, loc='best')
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16

在这里插入图片描述

解决方案

设置figure,函数原型Figure(figsize=None, dpi=None, facecolor=None, edgecolor=None, linewidth=0.0, frameon=None, subplotpars=None, tight_layout=None, constrained_layout=None)

figsize,图像尺寸,默认为[6.4, 4.8]

dpi,分辨率,默认为100.0

plt.figure(figsize=(a, b), dpi=dpi)
  • 1

参考文献

  1. matplotlib.pyplot
  2. matplotlib.figure.Figure
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/盐析白兔/article/detail/831791?site
推荐阅读
相关标签
  

闽ICP备14008679号