NumPy Matplotlib.pyplot学习

https://www.runoob.com/w3cnote/matplotlib-tutorial.html
https://www.jianshu.com/p/da385a35f68d

Matplotlib 是 Python 的绘图库。 它可与 NumPy 一起使用,提供了一种有效的 MatLab 开源替代方案。 它也可以和图形工具包一起使用,如 PyQt 和 wxPython。
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
如果这两种颜色不够用,还可以通过两种其他方式来定义颜色值:

1、使用HTML十六进制字符串 color=’#123456’ 使用合法的HTML颜色名字(’red’,’chartreuse’等)。
2、也可以传入一个归一化到[0,1]的RGB元祖。 color=(0.3,0.3,0.4)
背景色
通过向如matplotlib.pyplot.axes()或者matplotlib.pyplot.subplot()这样的方法提供一个axisbg参数,可以指定坐标这的背景色。

subplot(111,axisbg=(0.1843,0.3098,0.3098))
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

figure详解

plt.figure(num=None, figsize=None, dpi=None, facecolor=None, edgecolor=None, frameon=True, FigureClass=<class 'matplotlib.figure.Figure'>, clear=False, **kwargs)
    Create a new figure.

    Parameters
    ----------
    num : integer or string, optional, default: None,相当于图片名
            
    figsize : (float, float), optional, default: None        width, height in inches. If not provided, defaults to        :rc:`figure.figsize` = ``[6.4, 4.8]``.
    
    dpi : integer, optional, default: None        resolution of the figure. If not provided, defaults to        :rc:`figure.dpi` = ``100``.
    
    facecolor : color spec        the background color. If not provided, defaults to        :rc:`figure.facecolor` = ``'w'``.
    
    edgecolor : color spec        the border color. If not provided, defaults to        :rc:`figure.edgecolor` = ``'w'``.
    
    frameon : bool, optional, default: True        If False, suppress drawing the figure frame.
    
    FigureClass : subclass of `~matplotlib.figure.Figure`        Optionally use a custom `.Figure` instance.
    
    clear : bool, optional, default: False        If True and the figure already exists, then it is cleared.

plt.plot详解

plot(*args, scalex=True, scaley=True, data=None, **kwargs) method of matplotlib.axes._subplots.AxesSubplot instance
    Plot y versus x as lines and/or markers.
        
    Parameters
    ----------
    x, y : array-like or scalar      *x* values are optional and default to `range(len(y))`.   
        Commonly, these parameters are 1D arrays. They can also be scalars(标量), or two-dimensional (in that case, the
        columns represent separate data sets).        
    fmt : str, optional
        A format string, e.g. 'ro' for red circles. See next *Notes*.
        Format strings are just an abbreviation for quickly setting basic line properties. All of these and more can also be
        controlled by keyword arguments.                
    data : indexable object, optional
        An object with labelled data. If given, provide the label names to plot in *x* and *y*.
       
    Other Parameters
    ----------------
    scalex, scaley : bool, optional, default: True 不用管
                 
    **kwargs : `.Line2D` properties
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值