mpl¶
This is an object-oriented plotting library.
A procedural interface is provided by the companion pyplot module, which may be imported directly, e.g.:
import matplotlib.pyplot as plt
or using ipython:
ipython
at your terminal, followed by:
In [1]: %matplotlib
In [2]: import matplotlib.pyplot as plt
at the ipython shell prompt.
For the most part, direct use of the object-oriented library is
encouraged when programming; pyplot is primarily for working
interactively. The
exceptions are the pyplot commands figure(),
subplot(),
subplots(), and
savefig(), which can greatly simplify scripting.
Modules include:
matplotlib.axes- defines the
Axesclass. Most pylab commands are wrappers forAxesmethods. The axes module is the highest level of OO access to the library.matplotlib.figure- defines the
Figureclass.matplotlib.artist- defines the
Artistbase class for all classes that draw things.matplotlib.lines- defines the
Line2Dclass for drawing lines and markersmatplotlib.patches- defines classes for drawing polygons
matplotlib.text- defines the
Text,TextWithDash, andAnnotateclassesmatplotlib.image- defines the
AxesImageandFigureImageclassesmatplotlib.collections- classes for efficient drawing of groups of lines or polygons
matplotlib.colors- classes for interpreting color specifications and for making colormaps
matplotlib.cm- colormaps and the
ScalarMappablemixin class for providing color mapping functionality to other classesmatplotlib.ticker- classes for calculating tick mark locations and for formatting tick labels
matplotlib.backends- a subpackage with modules for various gui libraries and output formats
The base matplotlib namespace includes:
rcParams- a global dictionary of default configuration settings. It is initialized by code which may be overridded by a matplotlibrc file.
rc()- a function for setting groups of rcParams values
use()- a function for setting the matplotlib backend. If used, this function must be called immediately after importing matplotlib for the first time. In particular, it must be called before importing pylab (if pylab is imported).
matplotlib was initially written by John D. Hunter (1968-2012) and is now developed and maintained by a host of others.
Occasionally the internal documentation (python docstrings) will refer to MATLAB®, a registered trademark of The MathWorks, Inc.
Functions¶
checkdep_dvipng() |
|
checkdep_ghostscript() |
|
checkdep_inkscape() |
|
checkdep_pdftops() |
|
checkdep_ps_distiller(s) |
|
checkdep_tex() |
|
checkdep_usetex(s) |
|
checkdep_xmllint() |
|
compare_versions(a, b) |
return True if a is greater than or equal to b |
converter(value) |
|
cycler(*args, **kwargs) |
Creates a cycler.Cycler object much like cycler.cycler(), but includes input validation. |
dedent(s) |
Remove excess indentation from docstring s. |
get_backend() |
Return the name of the current backend. |
get_cachedir(*args, **kwargs) |
Return the location of the cache directory. |
get_configdir(*args, **kwargs) |
Return the string representing the configuration directory. |
get_data_path(*args, **kwargs) |
|
get_example_data(fname) |
get_example_data is deprecated – use matplotlib.cbook.get_sample_data |
get_home(*args, **kwargs) |
Find user’s home directory if possible. |
get_label(y, default_name) |
|
get_py2exe_datafiles() |
|
interactive(b) |
Set interactive mode to boolean b. |
is_interactive() |
Return true if plot mode is interactive |
is_string_like(obj) |
Return True if obj looks like a string |
is_url(filename) |
Return True if string is an http, ftp, or file URL path. |
matplotlib_fname() |
Get the location of the config file. |
rc(group, **kwargs) |
Set the current rc params. |
rc_file(fname) |
Update rc params from file. |
rc_file_defaults() |
Restore the default rc params from the original matplotlib rc that |
rc_params([fail_on_error]) |
Return a matplotlib.RcParams instance from the default matplotlib rc file. |
rc_params_from_file(fname[, fail_on_error, ...]) |
Return matplotlib.RcParams from the contents of the given file. |
rcdefaults() |
Restore the default rc params. |
reload((module) -> module) |
Reload the module. |
test([verbosity]) |
run the matplotlib test suite |
tk_window_focus() |
Return true if focus maintenance under TkAgg on win32 is on. |
unpack_labeled_data([replace_names, ...]) |
A decorator to add a ‘data’ kwarg to any a function. |
urlopen(url[, data, timeout, cafile, ...]) |
|
use(arg[, warn, force]) |
Set the matplotlib backend to one of the known backends. |
validate_backend(s) |
|
verify_test_dependencies() |
Classes¶
RcParams(*args, **kwargs) |
A dictionary object including validation |
Verbose() |
A class to handle reporting. |
chain |
chain(*iterables) –> chain object |
rc_context([rc, fname]) |
Return a context manager for managing rc settings. |
Exceptions¶
mplDeprecation |
alias of MatplotlibDeprecationWarning |