Skip to content

Get wx backends and examples compitable with Phoenix #2803

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 126 commits into from
Closed
Changes from 4 commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
eff9217
Don't free a font that hasn't been created
mdboom Dec 2, 2013
ec2212e
Don't clear glyphs if the face was never created.
mdboom Dec 2, 2013
cbb1d4c
- get wx backends compatible with wxPython Phoenix
wernerfb Feb 11, 2014
556ff86
- get wx examples compatible with wxPython Phoenix
wernerfb Feb 11, 2014
7b9fef5
replaces epd and pythonxy with anaconda and canopy. Also, added some …
katyhuff Jul 12, 2014
7108099
adds dyld_fallback_library_path
katyhuff Jul 12, 2014
a79cfc6
removing pythonxy
katyhuff Jul 12, 2014
d847a85
reformatting for line length
katyhuff Jul 12, 2014
7e2fdd2
redhat->linux
katyhuff Jul 12, 2014
156ff59
drops pylab reference
katyhuff Jul 12, 2014
a68e33e
getting rid of extra space
katyhuff Jul 12, 2014
9bd9c6f
both are good distributions
katyhuff Jul 12, 2014
1b3243c
conda libpng and freetype don't help
katyhuff Jul 12, 2014
9dedc0f
DOC : change how OO/pyplot/pylab is addressed
tacaswell Jun 30, 2014
a2b9461
DOC : grammer fixes and doc edits
tacaswell Jul 4, 2014
adc9ec4
DOC : edits to usage_faq.rst
tacaswell Jul 13, 2014
a52cd33
Two
katyhuff Jul 13, 2014
40861f7
moves libpng from optional to required
katyhuff Jul 13, 2014
386a088
TST: do not remove files while they are open
cgohlke Jul 13, 2014
aec5a56
BUG: do not remove file if passed in file object
cgohlke Jul 13, 2014
0a6ee42
TST: On Windows open files can not be removed
cgohlke Jul 13, 2014
ac1a333
STY: remove unused imports in plot_directive
matthew-brett Jul 14, 2014
d160d6c
STY: pep8 2 lines between functions
matthew-brett Jul 14, 2014
7f0a450
MNT: remove Python 2.7 copy of relpath
matthew-brett Jul 14, 2014
d1388d3
STY: typos in plot_directive docstrings
matthew-brett Jul 14, 2014
802e267
BUG: don't show parens, comma when no source link
matthew-brett Jul 14, 2014
8755041
puts pythonxy back in
katyhuff Jul 14, 2014
4efb43a
python(x,y) is now on google code?
katyhuff Jul 16, 2014
16cc1c4
Upload artifacts only on main repository.
mdboom Jul 16, 2014
7f447e0
Merge pull request #3269 from mdboom/artifacts-master-only
tacaswell Jul 16, 2014
448179a
Merge pull request #3238 from katyhuff/osx_install
dmcdougall Jul 17, 2014
674044e
Merge pull request #3257 from matthew-brett/refactor-plot-directive
dmcdougall Jul 17, 2014
92ff77b
Merge branch 'v1.4.x'
tacaswell Jul 17, 2014
7f79ca5
Merge pull request #3247 from tacaswell/usage_faq
pelson Jul 17, 2014
0168960
Merge branch 'v1.4.x'
pelson Jul 17, 2014
5e07591
Merge branch 'v1.4.x'
tacaswell Jul 18, 2014
4314d44
Merge pull request #3250 from cgohlke/patch-2
tacaswell Jul 18, 2014
bd67783
Rewrite checks to use communicate.
jenshnielsen Jul 11, 2014
04536ea
Silence some more cloesed file warnings
jenshnielsen Jul 12, 2014
78e7531
Ensure that file is closed in texmanager
jenshnielsen Jul 12, 2014
dfcbe97
Remove leftover debug
jenshnielsen Jul 12, 2014
cd3b775
Correct stdout in dvipng_hack
jenshnielsen Jul 12, 2014
5728b56
Change checks to more closly match the original
jenshnielsen Jul 13, 2014
461264e
Add breaks to match original
jenshnielsen Jul 13, 2014
053648a
Merge pull request #3235 from jenshnielsen/more_warnings
mdboom Jul 21, 2014
0287479
Merge remote-tracking branch 'upstream/v1.4.x'
mdboom Jul 21, 2014
0fb7914
BUG : fix _reshape_2D bug with [(n, 1), ..] input
tacaswell Jul 22, 2014
5f68f64
Change num lines to int in hatch.
jenshnielsen Jul 12, 2014
687f1f8
Index with an integer in test_axes
jenshnielsen Jul 12, 2014
4d3b23a
Number of verts in simplification is an int
jenshnielsen Jul 12, 2014
e559ace
Explicite cast to int in colors
jenshnielsen Jul 12, 2014
82496ee
Cast steps to integer in cbook
jenshnielsen Jul 12, 2014
d7a5c8e
Cast to integer in bezier for indexing
jenshnielsen Jul 12, 2014
dc87d3b
Cast to integer in contour
jenshnielsen Jul 12, 2014
8993188
Integer division in mlab test
jenshnielsen Jul 12, 2014
2c37ba1
Integer division in trirefine
jenshnielsen Jul 12, 2014
cd75c01
Filter warnings in rcparams test.
jenshnielsen Jul 12, 2014
c56ece1
Suppress some more warnings.
jenshnielsen Jul 12, 2014
ef2c5fa
Catch warning thrown in Mollweide projection.
jenshnielsen Jul 21, 2014
ffe211e
Filter warnings with more selective np.errstate context
lpsinger Jul 21, 2014
a94e43f
Remove redundant cast to int
jenshnielsen Jul 23, 2014
a7e673d
Delay the cast to int in contour.py
jenshnielsen Jul 23, 2014
e572706
Merge pull request #3296 from matplotlib/v1.4.x
tacaswell Jul 23, 2014
1aa2e58
Added 'double arrow' (DArrow) to patches.BoxStyle.
lkilcher Jul 3, 2014
50ba22f
Added image test for arrow patches.
lkilcher Jul 22, 2014
8e6aff2
Update patches doc and example.
lkilcher Jul 23, 2014
1a87326
Merge pull request #3284 from tacaswell/cbook_bxpstats_fix
WeatherGod Jul 24, 2014
9e9a3cd
Merge pull request #3194 from lkilcher/annotate_bbox_DArrow
tacaswell Jul 24, 2014
155e1f7
Catch warnings in tightlayout test.
jenshnielsen Jul 21, 2014
669c379
Add note about disabling warnings in test_rcparams
jenshnielsen Jul 26, 2014
855407b
Add note to test_subplots
jenshnielsen Jul 26, 2014
8727205
Add note to test_tightlayout
jenshnielsen Jul 26, 2014
57040ac
Suppress deprecation warning for Delaunay module in the test suite
jenshnielsen Jul 26, 2014
1b7856e
Suppress warning due to NaNs in this test.
jenshnielsen Jul 26, 2014
58ac6a8
Suppress warning when handling NaNs in streamplot
jenshnielsen Jul 26, 2014
edffd3c
Use assert_array_almost_equal from numpy.ma
jenshnielsen Jul 26, 2014
827393e
Use ma.testutils rather than a filter for warnings with NaN in
jenshnielsen Jul 26, 2014
9aea0d4
Fixed error with QSizePolicy
Jul 29, 2014
c01d5e6
Replaced unicode() function by six.text_type
Jul 29, 2014
11b86d3
Merge pull request #3323 from MrLeeh/patch-2
tacaswell Jul 29, 2014
926bc63
MNT : bumped version on master branch to 1.5.x
tacaswell Jul 29, 2014
c04a828
Merge remote-tracking branch 'v1.4.x'
tacaswell Jul 29, 2014
d797bc1
Fix #3304.
mdboom Jul 29, 2014
a501abb
Fix exception message
mdboom Jul 29, 2014
5b0e0d8
Simplify reference counting
mdboom Jul 29, 2014
3ca461e
Merge pull request #3324 from mdboom/backend-agg-crash
tacaswell Jul 31, 2014
284f56a
Merge branch 'v1.4.x'
tacaswell Jul 31, 2014
6ba32e8
DOC : added folders for api_changes and whats_new
tacaswell Jul 31, 2014
31a0af5
Merge pull request #3322 from MrLeeh/patch-1
tacaswell Aug 6, 2014
96a3ea2
Reduce minimum freetype version to 2.3
mdboom Aug 6, 2014
40b6020
Merge pull request #3262 from mdboom/min-freetype-version
tacaswell Aug 6, 2014
f0d098c
Merge branch 'v1.4.x' into master
efiring Aug 7, 2014
d192293
Merge branch 'v1.4.x'
pelson Aug 8, 2014
0b73eda
Merge branch 'v1.4.x'
pelson Aug 8, 2014
811761a
DOC : tweaked api_change/whats_new README
tacaswell Aug 8, 2014
34737d9
PEP8 conformity; removed outcommented code
MartinThoma Aug 10, 2014
17adaa2
Merge pull request #3359 from MartinThoma/master
efiring Aug 11, 2014
7bf8154
DOC: Fixed the wording of the deprecation warning
ericdill Aug 15, 2014
15fd1b4
Merge pull request #3372 from ericdill/qt4compat
tacaswell Aug 15, 2014
b1ebb3c
Merge branch 'v1.4.x'
tacaswell Aug 15, 2014
fb27b4c
Merge pull request #3349 from tacaswell/api_whats_new_folders
efiring Aug 17, 2014
481314e
BUG: Fixes custom path marker sizing for issue #1980
cimarronm Aug 17, 2014
3477744
TST: Updated vertex_markers baseline image for marker size fix
cimarronm Aug 18, 2014
edeba33
DOC: Elaborated marker style documentation for custom-defined markers
cimarronm Aug 18, 2014
f27b180
Move stylelib to mpl-data
cgohlke Aug 20, 2014
31b63f9
Load styles from mpl-data
cgohlke Aug 20, 2014
7afa906
Include stylelib files in MANIFEST.in
cgohlke Aug 20, 2014
d4abb37
Include stylelib files in package_data
cgohlke Aug 20, 2014
559c915
Merge pull request #3390 from cgohlke/move_stylelib
efiring Aug 21, 2014
a43a2f9
MNT : Merge branch 'v1.4.x' back into master
tacaswell Aug 21, 2014
f4782da
DOC : add note about np.matrix and pandas objects
tacaswell Aug 22, 2014
676f04b
DOC : add examples of casting DataFrame and matrix
tacaswell Aug 22, 2014
aa49f1f
Merge pull request #3394 from tacaswell/input_type_faq
jenshnielsen Aug 22, 2014
d5e0e9d
Merge pull request #3397 from tacaswell/install_guide_tweaks
jenshnielsen Aug 22, 2014
98d19db
Merge pull request #3378 from cimarronm/custommarkersizefix
tacaswell Aug 26, 2014
82ac087
Merge pull request #3244 from jenshnielsen/rcwarnings
tacaswell Aug 26, 2014
9a42b8d
Merge pull request #3241 from jenshnielsen/numpy_clean_warnings
tacaswell Aug 26, 2014
9d648fc
Merge pull request #2635 from mdboom/font-crash
tacaswell Aug 26, 2014
9661a02
Merge pull request #3282 from jenshnielsen/mollweide_warning
tacaswell Aug 26, 2014
5499980
- get wx backends compatible with wxPython Phoenix
wernerfb Feb 11, 2014
6acf934
- get wx examples compatible with wxPython Phoenix
wernerfb Feb 11, 2014
245a384
- set a variable at import time for wxPython classic/phoenix version
wernerfb Aug 27, 2014
cccfb24
- use wxversion only in Py2
wernerfb Aug 27, 2014
cdbde0b
- use wxversion only in Py2
wernerfb Aug 27, 2014
11648f3
- sometimes get an except: builtins.AttributeError: 'App' object has …
wernerfb Aug 27, 2014
33e3428
Merge branch 'wxPythonPhoenix' of github.com:wernerfb/matplotlib into…
wernerfb Aug 27, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 91 additions & 51 deletions doc/faq/usage_faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,38 +48,52 @@ completely, leaving a purely object-oriented approach.

.. _pylab:

Matplotlib, pylab, and pyplot: how are they related?
Matplotlib, pyplot and pylab: how are they related?
====================================================

Matplotlib is the whole package; :mod:`pylab` is a module in matplotlib
that gets installed alongside :mod:`matplotlib`; and :mod:`matplotlib.pyplot`
is a module in matplotlib.
Matplotlib is the whole package; :mod:`matplotlib.pyplot`
is a module in matplotlib; and :mod:`pylab` is a module
that gets installed alongside :mod:`matplotlib`.

Pyplot provides the state-machine interface to the underlying plotting
library in matplotlib. This means that figures and axes are implicitly
and automatically created to achieve the desired plot. For example,
calling ``plot`` from pyplot will automatically create the necessary
figure and axes to achieve the desired plot. Setting a title will
then automatically set that title to the current axes object::
Pyplot provides the state-machine interface to the underlying
object-oriented plotting library. The state-machine implicitly and
automatically creates figures and axes to achieve the desired
plot. For example::

import matplotlib.pyplot as plt

plt.plot(range(10), range(10))
plt.title("Simple Plot")
plt.show()
import matplotlib.pyplot as plt
import numpy as np

x = np.linspace(0, 2, 100)

plt.plot(x, x, label='linear')
plt.plot(x, x**2, label='quadratic')
plt.plot(x, x**3, label='cubic')

plt.xlabel('x label')
plt.ylabel('y label')

plt.title("Simple Plot")

plt.legend()

Pylab combines the pyplot functionality (for plotting) with the numpy
functionality (for mathematics and for working with arrays)
in a single namespace, making that namespace
(or environment) even more MATLAB-like.
For example, one can call the `sin` and `cos` functions just like
you could in MATLAB, as well as having all the features of pyplot.
plt.show()

The pyplot interface is generally preferred for non-interactive plotting
(i.e., scripting). The pylab interface is convenient for interactive
calculations and plotting, as it minimizes typing. Note that this is
what you get if you use the *ipython* shell with the *-pylab* option,
which imports everything from pylab and makes plotting fully interactive.
The first call to ``plt.plot`` will automatically create the necessary
figure and axes to achieve the desired plot. Subsequent calls to
``plt.plot`` re-use the current axes and each add another line.
Setting the title, legend, and axis labels also automatically use the
current axes and set the title, create the legend, and label the axis
respectively.

:mod:`pylab` is a convenience module that bulk imports
:mod:`matplotlib.pyplot` (for plotting) and :mod:`numpy`
(for mathematics and working with arrays) in a single name space.
Although many examples use :mod:`pylab`, it is no longer recommended.

For non-interactive plotting it is suggested
to use pyplot to create the figures and then the OO interface for
plotting.

.. _coding_styles:

Expand All @@ -99,25 +113,14 @@ The only caveat is to avoid mixing the coding styles for your own code.
Of the different styles, there are two that are officially supported.
Therefore, these are the preferred ways to use matplotlib.

For the preferred pyplot style, the imports at the top of your
For the pyplot style, the imports at the top of your
scripts will typically be::

import matplotlib.pyplot as plt
import numpy as np

Then one calls, for example, np.arange, np.zeros, np.pi, plt.figure,
plt.plot, plt.show, etc. So, a simple example in this style would be::

import matplotlib.pyplot as plt
import numpy as np
x = np.arange(0, 10, 0.2)
y = np.sin(x)
plt.plot(x, y)
plt.show()

Note that this example used pyplot's state-machine to
automatically and implicitly create a figure and an axes. For full
control of your plots and more advanced usage, use the pyplot interface
plt.plot, plt.show, etc. Use the pyplot interface
for creating figures, and then use the object methods for the rest::

import matplotlib.pyplot as plt
Expand All @@ -129,22 +132,59 @@ for creating figures, and then use the object methods for the rest::
ax.plot(x, y)
plt.show()

Next, the same example using a pure MATLAB-style::
So, why all the extra typing instead of the MATLAB-style (which relies
on global state and a flat namespace)? For very simple things like
this example, the only advantage is academic: the wordier styles are
more explicit, more clear as to where things come from and what is
going on. For more complicated applications, this explicitness and
clarity becomes increasingly valuable, and the richer and more
complete object-oriented interface will likely make the program easier
to write and maintain.

Typically one finds oneself making the same plots over and over
again, but with different data sets, which leads to needing to write
specialized functions to do the plotting. The recommended function
signature is something like: ::

def my_plotter(ax, data1, data2, param_dict):
"""
A helper function to make a graph

Parameters
----------
ax : Axes
The axes to draw to

data1 : array
The x data

data2 : array
The y data

param_dict : dict
Dictionary of kwargs to pass to ax.plot

Returns
-------
out : list
list of artists added
"""
out = ax.plot(data1, data2, **param_dict)
return out

which you would then use as::

fig, ax = plt.subplots(1, 1)
my_plotter(ax, data1, data2, {'marker':'x'})

from pylab import *
x = arange(0, 10, 0.2)
y = sin(x)
plot(x, y)
show()
or if you wanted to have 2 sub-plots::

fig, (ax1, ax2) = plt.subplots(1, 2)
my_plotter(ax1, data1, data2, {'marker':'x'})
my_plotter(ax2, data3, data4, {'marker':'o'})

So, why all the extra typing as one moves away from the pure
MATLAB-style? For very simple things like this example, the only
advantage is academic: the wordier styles are more explicit, more
clear as to where things come from and what is going on. For more
complicated applications, this explicitness and clarity becomes
increasingly valuable, and the richer and more complete object-oriented
interface will likely make the program easier to write and maintain.
Again, for these simple examples this style seems like overkill, however
once the graphs get slightly more complex it pays off.

.. _what-is-a-backend:

Expand Down