Use Python matplotlib library for plotting

Source: Internet
Author: User
Tags install matplotlib

Matplotlib installation can see the official website link http://matplotlib.org/users/installing.html

The following is a summary of the steps:

Download the. exe file on Windows.

1. Download and install python.

2. Install matplotlib of the required version (based on the Python version in step 1 ,.

The following is the library on which matplotlib is installed:

3. For python of Standard Edition, to use matplotlib, you also need to install the numpy module.

4. msvcp71.dll. On some systems, you may need to download the msvcp71.dll library. Download

Decompress the file and drag it to the c: \ windows \ system32 directory.

5. Run a simple program example:

 

import matplotlib.pyplot as pltplt.plot([1,2,3])plt.ylabel('some numbers')plt.show()

The following error was found:

Raise importerror ("matplotlib requires dateutil ")
Importerror: matplotlib requires dateutil

This requires dateutil. You can download and install it here.

After dateutil is installed, the following error occurs:

Raise importerror ("matplotlib requires pyparsing ")
Importerror: matplotlib requires pyparsing

You need to download and install pyparsing here.

After completing the above steps, run the above example to display our image, as shown below.



If you encounter some dependent packages that need to be installed during program installation, you can find them here, which is indeed a good resource.

You can select the corresponding image in the link below to modify the image you want.

Example: http://matplotlib.org/examples/index.html, Gallery: http://matplotlib.org/gallery.html

Pay attention to the Chinese solution during plotting. Add the following content to the header of the. py file:

  1. #-*-Coding: UTF-8 -*-
  2. From pylab import *
  3. MPL. rcparams ['font. Sans-serif'] = ['simhei'] # specify the default font
  4. MPL. rcparams ['axes. unicode_minus '] = false # solve the problem of saving the image as a negative sign'-'and displaying it as a square

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.