Python Data analysis----matplotlib

Source: Internet
Author: User
Tags install matplotlib

Matplotlib is a powerful toolkit for Python drawing and data visualization.

Installation method: Pip Install Matplotlib

Reference method: Import Matplotlib.pyplot as Plt

Drawing function: Plt.plot ()

Display Image: Plt.show ()

Simple example:

Import Matplotlib.pyplot as Pltin [269]: x = np.linspace (5,15,1000) in [+]: y = x*xIn [271]: PLT . plot (x, y) out[271]: [<matplotlib.lines.line2d at 0x10bdbd198>]in [272]: Plt.show ()

Image

Plot function:

    • Linetype LineStyle (-,-.,--,.. )
    • Point type marker (V,^,s,*,h,+,x,d,o,... )
    • Colour Color (b,g,r,y,k,w,... )
    • Plot function plots multiple curves
    • Title: Set_title
    • X-axis: Set_xlabel
    • Y-Axis: Y_label
    • Other types of images:
      • hist Frequency Histogram

Canvas and graph:

Canvas: Figure

    • Fig = Plt.figure ()

Figure: Subplot

    • Ax1 = Fig.add_subplot (2,2,1) #2行2列放第一个位置

Adjust Sub-chart spacing:

    • Subplots_adjust (left, bottom, right, top, wspace, hspace)

Python Data analysis----matplotlib

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.