matplotlib.pyplot.figure()--最容易被忽略的一些参数,但是很常用!

matplotlib.pyplot.figure()–最容易被忽略的一些参数,但是很常用!

matplotlib官方网站
在这里插入图片描述

matplotlib.pyplot.figure (常用 plt.figure())

matplotlib.pyplot.figure(num=None,figsize=None,dpi=None,facecolor=None,edgecolor=None,frameon=True,FigureClass=<class ‘matplotlib.figure.Figure’>, clear=False, kwargs)
Parameters:

  1. num:int or str or Figure,optional (一般不常用)
  2. figsize:(float,float) 图像大小 (宽,高)
  3. dpi:float,默认值100,分辨率,保证图片的清晰度
  4. facecolor:color,默认 ‘white’ 背景颜色
  5. edgecolor:color,默认‘white’,边框颜色
  6. clear:bool ,默认False. 如果为True并且该图形已经存在,则将其清除

一般使用以上参数即可,其他参数不常用。
例:plt.figure(figsize=(10,5),dpi=600,facecolor='white',edgecolor='white')

猜你喜欢

转载自blog.csdn.net/weixin_50918736/article/details/125833711