|
Code: subplot_demo.py
|
|
|
Multiple regular axes are created with subplot. This is a screenshot of the
matplotlib figure window. Navigation controls on the bottom of the
figure support a variety of pan and zoom modes.
|
|
|
|
Code: ellipse_demo.py
|
|
|
|
In support of the
Phoenix
mission to Mars, which used matplotlib in ground tracking of the
spacecraft, Michael Droettboom built on work by Charlie Moad to
provide an extremely accurate 8-spline approximation
to elliptical arcs in the
viewport. This provides a scale free, accurate graph of the arc
regardless of zoom level
|
|
Code: barchart_demo.py
|
|
|
|
The bar
command takes error bars as an optional argument. You can also use up
and down bars, stacked bars, 'candlestick' bars, etc, ... See bar_stacked.py for another example.
You can make horizontal bar charts with the barh command.
|
|
Code: pie_demo.py
|
|
|
|
The pie command
uses a matlab(TM) compatible syntax to produce py charts. Optional
features include auto-labeling the percentage of area, "exploding" one
or more wedges out from the center of the pie, and a shadow effect.
Take a close look at the attached code that produced this figure; nine
lines of code.
|
|
|
Code: scatter_demo2.py
|
|
|
|
The scatter command makes a
scatter plot with (optional) size and color arguments. This example
plots changes in Intel's stock price from one day to the next with the
sizes coding trading volume and the colors coding price change in day
i. Here the alpha attribute is used to make semitransparent circle
markers with the Agg backend
|
|
Code: slider_demo.py
|
|
|
|
Matplotlib has basic GUI widgets that are independent of the graphical
user interface you are using, allowing you to write cross GUI figures
and widgets. See widgets
classdocs and examples/widgets/*.py
|
|
Code: fill_demo.py
|
|
|
|
The fill, command lets you
plot filled polygons. Thanks to Andrew Straw for providing this
function.
|
|
Code: date_demo.py
|
|
|
|
You can plot date data with major and minor ticks and custom tick
formatters for both the major and minor ticks; see ticker and dates for details and usage. This plot
uses the finance module to
retrieve stock data.
|
|
Code: finance_work2.py
|
|
|
|
You can make much more sophisticated financial
plots. This example emulates one of the ChartDirector
financial plot. Some of the data in the plot, are real financial
data, some are random traces that I used since the goal was to
illustrate plotting techniques, not market analysis!
|
|
Code: plotmap.py
|
|
|
|
Jeff Whitaker provided this example showing how to
efficiently plot a collection of lines over a colormap image using the
basemap
matplotlib toolkit (available from the download page). Many map projections are handled via the proj4
library: cylindrical equidistant, mercator, lambert
conformal conic, lambert azimuthal equal area, albers equal area conic
and stereographic. See the
entry on the wiki.
|
|
Code: log_shot.py
|
|
|
|
The semilogx, semilogy and loglog commands generate log
scaling on the respective axes. The lower subplot uses a base10 log
on the xaxis and a base 4 log on the y. Thanks to Andrew Straw,
Darren Dale and Gregory Lielens for contributions to the log scaling
infrastructure.
|
|
|
Code: legend_demo.py
|
|
|
|
The legend command automatically
generates figure legends, with matltab compatible legend placement
commands. Thanks to Charles Twardy for input on the legend
command
|
|
Code: mathtext_examples.py
|
|
|
|
A sampling of the many TeX expressions now
supported by matplotlib's internal mathtext engine. The mathtext module provides TeX style
mathematical expressions using freetype2 and the BaKoMa computer
modern or STIX fonts. See the mathtext
module for usage, licensing and backend information. matplotlib
mathtext is an independent implementation, and does not required TeX
or any external packages installed on your computer.
|
|
Code: wheeler_demo.py
|
|
|
|
Plot of Level Set (LSM), Phase Field (PFM) and Sharp Interface Models
to demonstrate schematically the difference between the three models.
The green and blue equations govern the behaviors of the LSM and PFM
respectively. The distance delta represents the nominal interface
width. The LSM requires an algorithmic construct while the PFM is a
first principles approach. Thanks to Daniel Wheeler for this nice
example of TeX rendering with usetex..
|
|
Code: eeg.py
|
|
|
You can embed matplotlib into pygtk, wxpython, Tk, FLTK
or Qt applications. Here is a screenshot of an eeg viewer written in
pygtk using matplotlib; the lower axes is using specgram to plot the
spectrogram of one of the EEG channels. The code demo linked above is
a much simpler example of embedding matplotlib in pygtk. For an
example of how to use the navigation toolbar in your applications, see
embedding_in_gtk2.py. If
you want to use matplotlib in a wx application, see embedding_in_wx2.py. If you
want to work with glade, see mpl_with_glade.py
|
|