Matplotlib Do not display graphics

Source: Internet
Author: User

Installed Matplotlib, using an example of the official test run, found that when using the paint function, the running script always show no image, Google a bit, and later found that the matplotlibrc file is not configured well.

Refer to the official documentation for the following steps

1. Find the matplotlibrc file path

Enter the following statement in the idle

Import Matplotlibmatplotlib.matplotlib_fname ()

My display is /USR/LIB64/PYTHON2.7/SITE-PACKAGES/MATPLOTLIB/MPL-DATA/MATPLOTLIBRC .

2.vim Modify this file

Change the backend option to your system's graphical environment (my system is OpenSUSE13.2, the environment is QT)

# The default backend; one of the GTK gtkagg Gtkcairo gtk3agg Gtk3cairo # cocoaagg macosx qt4agg tkagg WX wxagg Agg Cairo GDK PS PDF SVG # Template # You can also deploy your own backend outside of Matplotlib by # referring to the module name (which must is in the PYTHONPATH) as # ' module://my_backend 'backend      : Qt4agg

Reference Document: Customizing Matplotlib

Matplotlib Do not display graphics

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.