Home >Backend Development >Python Tutorial >ipython's Chinese description of %pylab

ipython's Chinese description of %pylab

高洛峰
高洛峰Original
2017-03-15 13:49:163179browse

Format: %pylab [--no-import-all] [gui]

This command will be executed in ipython or notebook environment Automatically load the numpy and matplotlib libraries, which have the same function as the following statements

import numpy

import matplotlib

from matplotlib import pylab, mlab, pyplot

np = numpy

plt = pyplot


## from IPython.

display import display

from IPython.core .pylabtools import figsize, getfigs


from pylab import *

from numpy import *

if --no-import-all is passed option, the last two statements above will not be executed

Optional gui parameters

Specify the backend available for matplotlib. The available parameters are, 'agg', 'gtk', 'gtk3 ', 'inline', 'ipympl', 'nbagg', 'notebook', 'osx', 'qt', 'qt4', 'qt5', 'tk', 'wx', if this parameter is set, it will Use the corresponding backend, otherwise use the default backend. Of course, you can also modify the default parameters in matplotlib's

configuration file.


In these Among the parameters, only the inline parameter will draw the chart directly on qtconsole or notebook, and the others will draw the chart in the new pop-up dialog box.


The above is the detailed content of ipython's Chinese description of %pylab. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn