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

Skip to content

Commit 9d369a1

Browse files
Merge branch 'master' into wx-inconsistencies
2 parents deeeeb6 + 254cdac commit 9d369a1

File tree

133 files changed

+1670
-2110
lines changed

Some content is hidden

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

133 files changed

+1670
-2110
lines changed

README.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ platforms. Matplotlib can be used in Python scripts, the Python and IPython
3333
shell (à la MATLAB or Mathematica), web application servers, and various
3434
graphical user interface toolkits.
3535

36+
NOTE: The current master branch is now Python 3 only. Python 2 support is
37+
being dropped.
38+
3639
`Home page <http://matplotlib.org/>`_
3740

3841
Installation
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
Deprecations
22
````````````
3-
``cbook.is_numlike`` is deprecated. Use ``isinstance(..., numbers.Number)``
4-
instead.
3+
The following functions and classes are deprecated:
4+
5+
- ``cbook.GetRealpathAndStat`` (which is only a helper for
6+
``get_realpath_and_stat``),
7+
- ``cbook.is_numlike`` (use ``isinstance(..., numbers.Number)`` instead),
8+
- ``mathtext.unichr_safe`` (use ``chr`` instead),
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
matplotlib.cbook.Bunch deprecated
2+
`````````````````````````````````
3+
The ``matplotlib.cbook.Bunch`` class has been deprecated. Instead, use
4+
`types.SimpleNamespace` from the standard library which provides the same
5+
functionality.

doc/users/whats_new.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -310,11 +310,12 @@ Thus, to force usage of PGI when both bindings are installed, import it first.
310310

311311

312312

313-
Cairo rendering for Qt and WX canvases
314-
--------------------------------------
313+
Cairo rendering for Qt, WX, and Tk canvases
314+
-------------------------------------------
315315

316-
The new ``Qt4Cairo``, ``Qt5Cairo``, and ``WXCairo`` backends allow Qt and Wx
317-
canvases to use Cairo rendering instead of Agg.
316+
The new ``Qt4Cairo``, ``Qt5Cairo``, ``WXCairo``, and ``TkCairo``
317+
backends allow Qt, Wx, and Tk canvases to use Cairo rendering instead of
318+
Agg.
318319

319320

320321
Added support for QT in new ToolManager

examples/api/custom_index_formatter.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
to leave out days on which there is no data, i.e. weekends. The example
88
below shows how to use an 'index formatter' to achieve the desired plot
99
"""
10-
from __future__ import print_function
1110
import numpy as np
1211
import matplotlib.pyplot as plt
1312
import matplotlib.cbook as cbook

examples/api/custom_projection_example.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,9 @@
33
Custom projection
44
=================
55
6-
Showcase Hammer projection by alleviating many features of
7-
matplotlib.
6+
Showcase Hammer projection by alleviating many features of Matplotlib.
87
"""
98

10-
11-
from __future__ import unicode_literals
12-
139
import matplotlib
1410
from matplotlib.axes import Axes
1511
from matplotlib.patches import Circle

examples/api/custom_scale_example.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,10 @@
33
Custom scale
44
============
55
6-
Create a custom scale, by implementing the
7-
scaling use for latitude data in a Mercator Projection.
6+
Create a custom scale, by implementing the scaling use for latitude data in a
7+
Mercator Projection.
88
"""
99

10-
11-
from __future__ import unicode_literals
12-
1310
import numpy as np
1411
from numpy import ma
1512
from matplotlib import scale as mscale

examples/api/engineering_formatter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
# `sep` (separator between the number and the prefix/unit).
3636
ax1.set_title('SI-prefix only ticklabels, 1-digit precision & '
3737
'thin space separator')
38-
formatter1 = EngFormatter(places=1, sep=u"\N{THIN SPACE}") # U+2009
38+
formatter1 = EngFormatter(places=1, sep="\N{THIN SPACE}") # U+2009
3939
ax1.xaxis.set_major_formatter(formatter1)
4040
ax1.plot(xs, ys)
4141
ax1.set_xlabel('Frequency [Hz]')

examples/api/filled_step.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import matplotlib.pyplot as plt
1515
import matplotlib.ticker as mticker
1616
from cycler import cycler
17-
from six.moves import zip
1817

1918

2019
def filled_hist(ax, edges, values, bottoms=None, orientation='v',
@@ -150,8 +149,8 @@ def stack_hist(ax, stacked_data, sty_cycle, bottoms=None,
150149
labels = itertools.repeat(None)
151150

152151
if label_data:
153-
loop_iter = enumerate((stacked_data[lab], lab, s) for lab, s in
154-
zip(labels, sty_cycle))
152+
loop_iter = enumerate((stacked_data[lab], lab, s)
153+
for lab, s in zip(labels, sty_cycle))
155154
else:
156155
loop_iter = enumerate(zip(stacked_data, labels, sty_cycle))
157156

examples/api/radar_chart.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,18 @@ class RadarAxes(PolarAxes):
6060
draw_patch = patch_dict[frame]
6161

6262
def __init__(self, *args, **kwargs):
63-
super(RadarAxes, self).__init__(*args, **kwargs)
63+
super().__init__(*args, **kwargs)
6464
# rotate plot such that the first axis is at the top
6565
self.set_theta_zero_location('N')
6666

6767
def fill(self, *args, **kwargs):
6868
"""Override fill so that line is closed by default"""
6969
closed = kwargs.pop('closed', True)
70-
return super(RadarAxes, self).fill(closed=closed, *args, **kwargs)
70+
return super().fill(closed=closed, *args, **kwargs)
7171

7272
def plot(self, *args, **kwargs):
7373
"""Override plot so that line is closed by default"""
74-
lines = super(RadarAxes, self).plot(*args, **kwargs)
74+
lines = super().plot(*args, **kwargs)
7575
for line in lines:
7676
self._close_line(line)
7777

examples/api/skewt.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def update_position(self, loc):
2828
# This ensures that the new value of the location is set before
2929
# any other updates take place
3030
self._loc = loc
31-
super(SkewXTick, self).update_position(loc)
31+
super().update_position(loc)
3232

3333
def _has_default_loc(self):
3434
return self.get_loc() is None
@@ -180,10 +180,10 @@ def upper_xlim(self):
180180

181181
if __name__ == '__main__':
182182
# Now make a simple example using the custom projection.
183+
from io import StringIO
183184
from matplotlib.ticker import (MultipleLocator, NullFormatter,
184185
ScalarFormatter)
185186
import matplotlib.pyplot as plt
186-
from six import StringIO
187187
import numpy as np
188188

189189
# Some examples data

examples/api/watermark_image.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
66
Use a PNG file as a watermark
77
"""
8-
from __future__ import print_function
98
import numpy as np
109
import matplotlib.cbook as cbook
1110
import matplotlib.image as image

examples/color/named_colors.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
66
Simple plot example with the named colors and its visual representation.
77
"""
8-
from __future__ import division
98

109
import matplotlib.pyplot as plt
1110
from matplotlib import colors as mcolors

examples/event_handling/close_event.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
66
Example to show connecting events that occur when the figure closes.
77
"""
8-
from __future__ import print_function
98
import matplotlib.pyplot as plt
109

1110

examples/event_handling/coords_demo.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
An example of how to interact with the plotting canvas by connecting
77
to move and click events
88
"""
9-
from __future__ import print_function
109
import sys
1110
import matplotlib.pyplot as plt
1211
import numpy as np

examples/event_handling/figure_axes_enter_leave.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
Illustrate the figure and axes enter and leave events by changing the
77
frame colors on enter and leave
88
"""
9-
from __future__ import print_function
109
import matplotlib.pyplot as plt
1110

1211

examples/event_handling/ginput_demo_sgskip.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
88
"""
99

10-
from __future__ import print_function
1110

1211
import matplotlib.pyplot as plt
1312
import numpy as np

examples/event_handling/ginput_manual_clabel_sgskip.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
1515
"""
1616

17-
from __future__ import print_function
1817

1918
import time
2019
import matplotlib

examples/event_handling/image_slices_viewer.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
66
Scroll through 2D image slices of a 3D array.
77
"""
8-
from __future__ import print_function
98

109
import numpy as np
1110
import matplotlib.pyplot as plt

examples/event_handling/keypress_demo.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
66
Show how to connect to keypress events
77
"""
8-
from __future__ import print_function
98
import sys
109
import numpy as np
1110
import matplotlib.pyplot as plt

examples/event_handling/pick_event_demo.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ def pick_handler(event):
6666
The examples below illustrate each of these methods.
6767
"""
6868

69-
from __future__ import print_function
7069
import matplotlib.pyplot as plt
7170
from matplotlib.lines import Line2D
7271
from matplotlib.patches import Rectangle

examples/event_handling/pipong.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
pipong.py was written by Paul Ivanov <http://pirsquared.org>
99
"""
1010

11-
from __future__ import print_function
1211

1312
import numpy as np
1413
import matplotlib.pyplot as plt

examples/event_handling/pong_sgskip.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
This example requires :download:`pipong.py <pipong.py>`
1111
1212
"""
13-
from __future__ import print_function, division
1413
import time
1514

1615

examples/images_contours_and_fields/image_demo.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
functionality of imshow and the many images you can create.
1111
1212
"""
13-
from __future__ import print_function
1413

1514
import numpy as np
1615
import matplotlib.cm as cm

examples/images_contours_and_fields/layer_images.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
66
Layer images above one another using alpha blending
77
"""
8-
from __future__ import division
98
import matplotlib.pyplot as plt
109
import numpy as np
1110

examples/lines_bars_and_markers/marker_reference.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
Reference for filled- and unfilled-marker types included with Matplotlib.
77
"""
8-
from six import iteritems
8+
99
import numpy as np
1010
import matplotlib.pyplot as plt
1111
from matplotlib.lines import Line2D
@@ -36,9 +36,7 @@ def split_list(a_list):
3636
fig, axes = plt.subplots(ncols=2)
3737

3838
# Filter out filled markers and marker settings that do nothing.
39-
# We use iteritems from six to make sure that we get an iterator
40-
# in both python 2 and 3
41-
unfilled_markers = [m for m, func in iteritems(Line2D.markers)
39+
unfilled_markers = [m for m, func in Line2D.markers.items()
4240
if func != 'nothing' and m not in Line2D.filled_markers]
4341
# Reverse-sort for pretty. We use our own sort key which is essentially
4442
# a python3 compatible reimplementation of python2 sort.

examples/lines_bars_and_markers/markevery_demo.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
2121
"""
2222

23-
from __future__ import division
2423
import numpy as np
2524
import matplotlib.pyplot as plt
2625
import matplotlib.gridspec as gridspec

examples/misc/anchored_artists.py

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,18 @@
44
================
55
66
"""
7-
from matplotlib.patches import Rectangle, Ellipse
87

9-
from matplotlib.offsetbox import AnchoredOffsetbox, AuxTransformBox, VPacker,\
10-
TextArea, DrawingArea
8+
from matplotlib.patches import Rectangle, Ellipse
9+
from matplotlib.offsetbox import (
10+
AnchoredOffsetbox, AuxTransformBox, DrawingArea, TextArea, VPacker)
1111

1212

1313
class AnchoredText(AnchoredOffsetbox):
1414
def __init__(self, s, loc, pad=0.4, borderpad=0.5,
1515
prop=None, frameon=True):
16-
17-
self.txt = TextArea(s,
18-
minimumdescent=False)
19-
20-
super(AnchoredText, self).__init__(loc, pad=pad, borderpad=borderpad,
21-
child=self.txt,
22-
prop=prop,
23-
frameon=frameon)
16+
self.txt = TextArea(s, minimumdescent=False)
17+
super().__init__(loc, pad=pad, borderpad=borderpad,
18+
child=self.txt, prop=prop, frameon=frameon)
2419

2520

2621
class AnchoredSizeBar(AnchoredOffsetbox):
@@ -42,10 +37,8 @@ def __init__(self, transform, size, label, loc,
4237
align="center",
4338
pad=0, sep=sep)
4439

45-
AnchoredOffsetbox.__init__(self, loc, pad=pad, borderpad=borderpad,
46-
child=self._box,
47-
prop=prop,
48-
frameon=frameon)
40+
super().__init__(loc, pad=pad, borderpad=borderpad,
41+
child=self._box, prop=prop, frameon=frameon)
4942

5043

5144
class AnchoredEllipse(AnchoredOffsetbox):
@@ -59,24 +52,16 @@ def __init__(self, transform, width, height, angle, loc,
5952
self._box = AuxTransformBox(transform)
6053
self.ellipse = Ellipse((0, 0), width, height, angle)
6154
self._box.add_artist(self.ellipse)
62-
63-
AnchoredOffsetbox.__init__(self, loc, pad=pad, borderpad=borderpad,
64-
child=self._box,
65-
prop=prop,
66-
frameon=frameon)
55+
super().__init__(loc, pad=pad, borderpad=borderpad,
56+
child=self._box, prop=prop, frameon=frameon)
6757

6858

6959
class AnchoredDrawingArea(AnchoredOffsetbox):
7060
def __init__(self, width, height, xdescent, ydescent,
7161
loc, pad=0.4, borderpad=0.5, prop=None, frameon=True):
72-
7362
self.da = DrawingArea(width, height, xdescent, ydescent)
74-
75-
super(AnchoredDrawingArea, self).__init__(loc, pad=pad,
76-
borderpad=borderpad,
77-
child=self.da,
78-
prop=None,
79-
frameon=frameon)
63+
super().__init__(loc, pad=pad, borderpad=borderpad,
64+
child=self.da, prop=None, frameon=frameon)
8065

8166

8267
if __name__ == "__main__":

examples/misc/cursor_demo_sgskip.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
https://github.com/joferkington/mpldatacursor
1717
https://github.com/anntzer/mplcursors
1818
"""
19-
from __future__ import print_function
2019
import matplotlib.pyplot as plt
2120
import numpy as np
2221

examples/misc/font_indexing.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
tables relate to one another. Mainly for mpl developers....
88
99
"""
10-
from __future__ import print_function
1110
import matplotlib
1211
from matplotlib.ft2font import FT2Font, KERNING_DEFAULT, KERNING_UNFITTED, KERNING_UNSCALED
1312

examples/misc/ftface_props.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
individual character metrics, use the Glyph object, as returned by
99
load_char
1010
"""
11-
from __future__ import print_function
1211
import matplotlib
1312
import matplotlib.ft2font as ft
1413

examples/misc/image_thumbnail_sgskip.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
1111
"""
1212

13-
from __future__ import print_function
1413
# build thumbnails of all images in a directory
1514
import sys
1615
import os

0 commit comments

Comments
 (0)