Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 71cf59f

Browse files
committed
Merge pull request matplotlib#2 from matplotlib/master
Update to matplotlib:master
2 parents b8cb6c3 + ef462e4 commit 71cf59f

58 files changed

Lines changed: 3100 additions & 484 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
1+
2014-05-02 Added colorblind-friendly colormap, named 'Wistia'.
2+
3+
2014-04-27 Improved input clean up in Axes.{h|v}lines
4+
Coerce input into a 1D ndarrays (after dealing with units).
5+
6+
2014-04-22 Added an example showing the difference between
7+
interpolation = 'none' and interpolation = 'nearest' in
8+
`imshow()` when saving vector graphics files.
9+
10+
2014-04-10 Fixed the triangular marker rendering error. The "Up" triangle was
11+
rendered instead of "Right" triangle and vice-versa.
12+
13+
2014-04-08 Fixed a bug in parasite_axes.py by making a list out
14+
of a generator at line 263.
15+
116
2014-03-27 Added tests for pie ccw parameter. Removed pdf and svg images
217
from tests for pie linewidth parameter.
318

19+
2014-03-24 Added bool kwarg (manage_xticks) to boxplot to enable/disable
20+
the managemnet of the xlimits and ticks when making a boxplot.
21+
Default in True which maintains current behavior by default.
22+
423
2014-03-22 Added the keyword arguments wedgeprops and textprops to pie.
524
Users can control the wedge and text properties of the pie
625
in more detail, if they choose.
@@ -11,9 +30,13 @@
1130

1231
2014-03-13 Add parameter 'clockwise' to function pie, True by default.
1332

14-
2014-27-02 Implemented separate horizontal/vertical axes padding to the
33+
2014-02-27 Implemented separate horizontal/vertical axes padding to the
1534
ImageGrid in the AxesGrid toolkit
1635

36+
2014-02-25 In backend_qt4agg changed from using update -> repaint under
37+
windows. See comment in source near `self._priv_update` for
38+
longer explaination.
39+
1740
2014-01-02 `triplot` now returns the artist it adds and support of line and
1841
marker kwargs has been improved. GBY
1942

@@ -31,6 +54,9 @@
3154
all pyplot.tri* methods) and mlab.griddata. Deprecated
3255
matplotlib.delaunay module. - IMT
3356

57+
2013-11-05 Add power-law normalization method. This is useful for,
58+
e.g., showing small populations in a "hist2d" histogram.
59+
3460
2013-10-27 Added get_rlabel_position and set_rlabel_position methods to
3561
PolarAxes to control angular position of radial tick labels.
3662

INSTALL

Lines changed: 42 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,10 @@ Build requirements
154154
==================
155155

156156
These are external packages which you will need to install before
157-
installing matplotlib. Windows users only need the first two (python
158-
and numpy) since the others are built into the matplotlib Windows
159-
installers available for download at `the download page
160-
<http://matplotlib.org/downloads.html>`_. If you are
161-
building on OSX, see :ref:`build_osx`. If you are installing
162-
dependencies with a package manager on Linux, you may need to install
163-
the development packages (look for a "-dev" postfix) in addition to
164-
the libraries themselves.
157+
installing matplotlib. If you are building on OSX, see
158+
:ref:`build_osx`. If you are installing dependencies with a package
159+
manager on Linux, you may need to install the development packages
160+
(look for a "-dev" postfix) in addition to the libraries themselves.
165161

166162
.. note::
167163

@@ -198,29 +194,12 @@ the libraries themselves.
198194
using pip, easy_install or installing from source, the installer
199195
will attempt to download and install `pyparsing` from PyPI.
200196

201-
<<<<<<< HEAD
202-
**Optional dependencies**
197+
six 1.3 or later
198+
Python 2/3 compatibility library. This is also a dependency of
199+
:term:`dateutil`.
203200

204-
`Pillow http://python-imaging.github.io/`__
205-
If Pillow is installed, matplotlib can read and write a larger
206-
selection of image file formats.
207201

208202
**Optional GUI frameworks**
209-
=======
210-
libpng 1.2 (or later)
211-
library for loading and saving :term:`PNG` files (`download
212-
<http://www.libpng.org/pub/png/libpng.html>`__). libpng requires
213-
zlib. If you are a Windows user, you can ignore this because we
214-
build support into the matplotlib single-click installer
215-
216-
:term:`freetype` 1.4 (or later)
217-
library for reading true type font files. If you are a windows
218-
user, you can ignore this since we build support into the
219-
matplotlib single click installer.
220-
221-
222-
**Optional**
223-
>>>>>>> upstream/v1.3.x
224203

225204
These are optional packages which you may want to install to use
226205
matplotlib with a user interface toolkit. See
@@ -241,6 +220,34 @@ backends and the capabilities they provide.
241220
The python wrappers for the wx widgets library for use with the
242221
WX or WXAgg backend
243222

223+
**Optional external programs**
224+
225+
ffmpeg/avconv or mencoder
226+
Required for the animation module to be save out put to movie
227+
formats.
228+
229+
ImageMagick
230+
Required for the animation module to be able to save to animated gif.
231+
232+
**Optional dependencies**
233+
234+
`Pillow http://python-imaging.github.io/`__
235+
If Pillow is installed, matplotlib can read and write a larger
236+
selection of image file formats.
237+
238+
239+
:term:`freetype` 1.4 (or later)
240+
library for reading true type font files. If you are a windows
241+
user, you can ignore this since we build support into the
242+
matplotlib single click installer.
243+
244+
245+
libpng 1.2 (or later)
246+
library for loading and saving :term:`PNG` files (`download
247+
<http://www.libpng.org/pub/png/libpng.html>`__). libpng requires
248+
zlib. If you are a Windows user, you can ignore this because we
249+
build support into the matplotlib single-click installer
250+
244251
**Required libraries that ship with matplotlib**
245252

246253
:term:`agg` 2.4
@@ -251,6 +258,13 @@ backends and the capabilities they provide.
251258
`PyCXX` 6.2.4
252259
A library for writing Python extensions in C++.
253260

261+
`qhull` 2012.1
262+
A library for computing convex hulls. Used for computing triangulation
263+
and meshes.
264+
265+
`ttconv`
266+
truetype font utility
267+
254268
.. _build_osx:
255269

256270
Building on OSX

doc/api/api_changes.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ For new features that were added to matplotlib, please see
1414
Changes in 1.4.x
1515
================
1616

17+
Code changes
18+
------------
19+
1720
* A major refactoring of the axes module was made. The axes module has been
1821
split into smaller modules:
1922

@@ -47,6 +50,10 @@ original location:
4750
- mstream -> `from matplotlib import stream as mstream`
4851
- mtable -> `from matplotlib import table as mtable`
4952

53+
* The :func:`~matplotlib.pyplot.errorbar` method has been changed such that
54+
the upper and lower limits (*lolims*, *uplims*, *xlolims*, *xuplims*) now
55+
point in the correct direction.
56+
5057
* The Sphinx extensions `ipython_directive` and
5158
`ipython_console_highlighting` have been moved to the IPython
5259
project itself. While they remain in matplotlib for this release,
@@ -134,6 +141,10 @@ original location:
134141
* Removed the class `FigureManagerQTAgg` and deprecated `NavigationToolbar2QTAgg`
135142
which will be removed in 1.5.
136143

144+
* Removed formerly public (non-prefixed) attributes `rect` and
145+
`drawRect` from `FigureCanvasQTAgg`; they were always an
146+
implementation detail of the (preserved) `drawRectangle()` function.
147+
137148
* The function signatures of `tight_bbox.adjust_bbox` and
138149
`tight_bbox.process_figure_for_rasterizing` have been changed. A new
139150
`fixed_dpi` parameter allows for overriding the `figure.dpi` setting
@@ -149,6 +160,15 @@ original location:
149160

150161
* Added clockwise parameter to control sectors direction in `axes.pie`
151162

163+
Code removal
164+
------------
165+
166+
* Removed ``mlab.levypdf``. The code raised a numpy error (and has for
167+
a long time) and was not the standard form of the Levy distribution.
168+
``scipy.stats.levy`` should be used instead
169+
170+
171+
152172

153173
.. _changes_in_1_3:
154174

doc/faq/installing_faq.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ Then, if you want to update your matplotlib at any time, just do::
153153

154154
When you run `git pull`, if the output shows that only Python files have been
155155
updated, you are all set. If C files have changed, you need to run the `python
156-
setupegg.py develop` command again to compile them.
156+
setup.py develop` command again to compile them.
157157

158158
There is more information on :ref:`using git <using-git>` in
159159
the developer docs.

doc/users/customizing.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ settings in a single group at once, using keyword arguments::
6767
import matplotlib as mpl
6868
mpl.rc('lines', linewidth=2, color='r')
6969

70-
There :func:`matplotlib.rcdefaults` command will restore the standard
71-
matplotlib default settings.
70+
The :func:`matplotlib.rcdefaults` command will restore the standard matplotlib
71+
default settings.
7272

7373
There is some degree of validation when setting the values of rcParams, see
7474
:mod:`matplotlib.rcsetup` for details.

doc/users/whats_new.rst

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,17 @@ revision, see the :ref:`github-stats`.
2323
new in matplotlib-1.4
2424
=====================
2525

26+
27+
New colormap
28+
------------
29+
In heatmaps, a green-to-red spectrum is often used to indicate intensity of
30+
activity, but this can be problematic for the red/green colorblind. A new,
31+
colorblind-friendly colormap is now available at :class:`matplotlib.cm.Wistia`.
32+
This colormap maintains the red/green symbolism while achieving deuteranopic
33+
legibility through brightness variations. See
34+
`here <https://github.com/wistia/heatmap-palette>`
35+
for more information.
36+
2637
Documentation changes
2738
---------------------
2839

@@ -32,6 +43,14 @@ Phil Elson rewrote of the documentation and userguide for both Legend and PathEf
3243
New plotting features
3344
---------------------
3445

46+
Power-law normalization
47+
```````````````````````
48+
Ben Gamari added a power-law normalization method,
49+
:class:`~matplotlib.colors.PowerNorm`. This class maps a range of
50+
values to the interval [0,1] with power-law scaling with the exponent
51+
provided by the constructor's `gamma` argument. Power law normalization
52+
can be useful for, e.g., emphasizing small populations in a histogram.
53+
3554
Fully customizable boxplots
3655
````````````````````````````
3756
Paul Hobson overhauled the :func:`~matplotlib.pyplot.boxplot` method such
@@ -56,6 +75,8 @@ kwargs. See the examples:
5675
:ref:`~examples/statistics/boxplot_demo.py` and
5776
:ref:`~examples/statistics/bxp_demo.py`
5877

78+
Added a bool kwarg, `manage_xticks`, which if False disables the management
79+
of the xtick and xlim by `boxplot`.
5980

6081
Support for datetime axes in 2d plots
6182
`````````````````````````````````````
@@ -139,6 +160,11 @@ specify wedgeprops = {'linewidth':3} to specify the width of the borders of
139160
the wedges in the pie. For more properties that the user can specify, look at
140161
the docs for the wedge and text objects.
141162

163+
Fixed the direction of errorbar upper/lower limits
164+
``````````````````````````````````````````````````
165+
Larry Bradley fixed the :func:`~matplotlib.pyplot.errorbar` method such
166+
that the upper and lower limits (*lolims*, *uplims*, *xlolims*,
167+
*xuplims*) now point in the correct direction.
142168

143169
Date handling
144170
-------------
@@ -200,6 +226,9 @@ added. Furthermore, the the subplottool is now implemented as a modal
200226
dialog. It was previously a QMainWindow, leaving the SPT open if one closed the
201227
plotwindow.
202228

229+
Interactive performance of the Qt4 backend has been dramatically improved
230+
under windows.
231+
203232
Cairo backends
204233
``````````````
205234

@@ -225,6 +254,14 @@ url as a link in output SVGs. This allows one to make clickable text in
225254
saved figures using the url kwarg of the :class:`~matplotlib.text.Text`
226255
class.
227256

257+
Sphinx extensions
258+
-----------------
259+
260+
The ``:context:`` directive in the `~matplotlib.sphinxext.plot_directive`
261+
Sphinx extension can now accept an optional ``reset`` setting, which will
262+
cause the context to be reset. This allows more than one distinct context to
263+
be present in documentation. To enable this option, use ``:context: reset``
264+
instead of ``:context:`` any time you want to reset the context.
228265

229266
.. _whats-new-1-3:
230267

examples/api/power_norm_demo.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/python
2+
3+
from matplotlib import pyplot as plt
4+
import matplotlib.colors as mcolors
5+
import numpy as np
6+
from numpy.random import multivariate_normal
7+
8+
data = np.vstack([multivariate_normal([10, 10], [[3, 5],[4, 2]], size=100000),
9+
multivariate_normal([30, 20], [[2, 3],[1, 3]], size=1000)
10+
])
11+
12+
gammas = [0.8, 0.5, 0.3]
13+
xgrid = np.floor((len(gammas) + 1.) / 2)
14+
ygrid = np.ceil((len(gammas) + 1.) / 2)
15+
16+
plt.subplot(xgrid, ygrid, 1)
17+
plt.title('Linear normalization')
18+
plt.hist2d(data[:,0], data[:,1], bins=100)
19+
20+
for i, gamma in enumerate(gammas):
21+
plt.subplot(xgrid, ygrid, i + 2)
22+
plt.title('Power law normalization\n$(\gamma=%1.1f)$' % gamma)
23+
plt.hist2d(data[:, 0], data[:, 1],
24+
bins=100, norm=mcolors.PowerNorm(gamma))
25+
26+
plt.subplots_adjust(hspace=0.39)
27+
plt.show()
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
"""
2+
Displays the difference between interpolation = 'none' and
3+
interpolation = 'nearest'.
4+
5+
Interpolation = 'none' and interpolation = 'nearest' are equivalent when
6+
converting a figure to an image file, such as a PNG.
7+
Interpolation = 'none' and interpolation = 'nearest' behave quite
8+
differently, however, when converting a figure to a vector graphics file,
9+
such as a PDF. As shown, Interpolation = 'none' works well when a big
10+
image is scaled down, while interpolation = 'nearest' works well when a
11+
small image is blown up.
12+
"""
13+
14+
import numpy as np
15+
import matplotlib.pyplot as plt
16+
import matplotlib.cbook as cbook
17+
18+
#Load big image
19+
big_im_path = cbook.get_sample_data('necked_tensile_specimen.png')
20+
big_im = plt.imread(big_im_path)
21+
#Define small image
22+
small_im = np.array([[0.25, 0.75, 1.0, 0.75], [0.1, 0.65, 0.5, 0.4], \
23+
[0.6, 0.3, 0.0, 0.2], [0.7, 0.9, 0.4, 0.6]])
24+
25+
#Create a 2x2 table of plots
26+
fig = plt.figure(figsize = [8.0, 7.5])
27+
ax = plt.subplot(2,2,1)
28+
ax.imshow(big_im, interpolation = 'none')
29+
ax = plt.subplot(2,2,2)
30+
ax.imshow(big_im, interpolation = 'nearest')
31+
ax = plt.subplot(2,2,3)
32+
ax.imshow(small_im, interpolation = 'none')
33+
ax = plt.subplot(2,2,4)
34+
ax.imshow(small_im, interpolation = 'nearest')
35+
plt.subplots_adjust(left = 0.24, wspace = 0.2, hspace = 0.1, \
36+
bottom = 0.05, top = 0.86)
37+
38+
#Label the rows and columns of the table
39+
fig.text(0.03, 0.645, 'Big Image\nScaled Down', ha = 'left')
40+
fig.text(0.03, 0.225, 'Small Image\nBlown Up', ha = 'left')
41+
fig.text(0.383, 0.90, "Interpolation = 'none'", ha = 'center')
42+
fig.text(0.75, 0.90, "Interpolation = 'nearest'", ha = 'center')
43+
44+
#If you were going to run this example on your local machine, you
45+
#would save the figure as a PNG, save the same figure as a PDF, and
46+
#then compare them. The following code would suffice.
47+
txt = fig1.text(0.452, 0.95, 'Saved as a PNG', fontsize = 18)
48+
# plt.savefig('None_vs_nearest-png.png')
49+
# txt.set_text('Saved as a PDF')
50+
# plt.savefig('None_vs_nearest-pdf.pdf')
51+
52+
#Here, however, we need to display the PDF on a webpage, which means
53+
#the PDF must be converted into an image. For the purposes of this
54+
#example, the 'Nearest_vs_none-pdf.pdf' has been pre-converted into
55+
#'Nearest_vs_none-pdf.png' at 80 dpi. We simply need to load and
56+
#display it.
57+
pdf_im_path = cbook.get_sample_data('None_vs_nearest-pdf.png')
58+
pdf_im = plt.imread(pdf_im_path)
59+
fig2 = plt.figure(figsize = [8.0, 7.5])
60+
plt.figimage(pdf_im)
61+
62+
plt.show()

0 commit comments

Comments
 (0)