8000 Fixes #1316. Default to `None` for rasterization_zorder. · matplotlib/matplotlib@8aca5e7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8aca5e7

Browse files
committed
Fixes #1316. Default to None for rasterization_zorder.
1 parent 7f5b005 commit 8aca5e7

File tree

2 files changed

+24
-15
lines changed

2 files changed

+24
-15
lines changed

doc/api/api_changes.rst

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

17+
* The `rasterization_zorder` property on `~matplotlib.axes.Axes` a
18+
zorder below which artists are rasterized. This has defaulted to
19+
-30000.0, but it now defaults to `None`, meaning no artists will be
20+
rasterized. In order to rasterize artists below a given zorder
21+
value, `set_rasterization_zorder` must be explicitly called.
22+
1723
* In :meth:`~matplotlib.axes.Axes.scatter`, and `~pyplot.scatter`,
1824
when specifying a marker using a tuple, the angle is now specified
1925
in degrees, not radians.
@@ -90,14 +96,14 @@ Changes in 1.2.x
9096
def transform(self, xy):
9197
...
9298
transform_non_affine = transform
93-
94-
99+
100+
95101
This approach will no longer function correctly and should be changed to::
96102

97103
class MyTransform(mtrans.Transform):
98104
def transform_non_affine(self, xy):
99105
...
100-
106+
101107

102108
* Artists no longer have ``x_isdata`` or ``y_isdata`` attributes; instead
103109
any artist's transform can be interrogated with
@@ -115,7 +121,7 @@ Changes in 1.2.x
115121
Bbox('array([[ 0., 0.],\n [ 90., 90.]])')
116122

117123
* One can now easily get a transform which goes from one transform's coordinate
118-
system to another, in an optimized way, using the new subtract method on a
124+
system to another, in an optimized way, using the new subtract method on a
119125
transform. For instance, to go from data coordinates to axes coordinates::
120126

121127
>>> import matplotlib.pyplot as plt
@@ -126,8 +132,8 @@ Changes in 1.2.x
126132
>>> print(data2ax.depth)
127133
2
128134

129-
for versions before 1.2 this could only be achieved in a sub-optimal wa 8000 y,
130-
using ``ax.transData + ax.transAxes.inverted()`` (depth is a new concept,
135+
for versions before 1.2 this could only be achieved in a sub-optimal way,
136+
using ``ax.transData + ax.transAxes.inverted()`` (depth is a new concept,
131137
but had it existed it would return 4 for this example).
132138

133139
* ``twinx`` and ``twiny`` now returns an instance of SubplotBase if
@@ -141,8 +147,8 @@ Changes in 1.2.x
141147
* :class:`~matplotlib.colors.ColorConverter`,
142148
:class:`~matplotlib.colors.Colormap` and
143149
:class:`~matplotlib.colors.Normalize` now subclasses ``object``
144-
145-
* ContourSet instances no longer have a ``transform`` attribute. Instead,
150+
151+
* ContourSet instances no longer have a ``transform`` attribute. Instead,
146152
access the transform with the ``get_transform`` method.
147153

148154
Changes in 1.1.x

lib/matplotlib/axes.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import matplotlib.collections as mcoll
1717
import matplotlib.colors as mcolors
1818
import matplotlib.contour as mcontour
19-
import matplotlib.dates as _ # <-registers a date unit converter
19+
import matplotlib.dates as _ # <-registers a date unit converter
2020
from matplotlib import docstring
2121
import matplotlib.font_manager as font_manager
2222
import matplotlib.image as mimage
@@ -465,7 +465,7 @@ def __init__(self, fig, rect,
465465
self._frameon = frameon
466466
self._axisbelow = rcParams['axes.axisbelow']
467467

468-
self._rasterization_zorder = -30000
468+
self._rasterization_zorder = None
469469

470470
self._hold = rcParams['axes.hold']
471471
self._connected = {} # a dict from events to (id, func)
@@ -1852,7 +1852,9 @@ def margins(self, *args, **kw):
18521852

18531853
def set_rasterization_zorder(self, z):
18541854
"""
1855-
Set zorder value below which artists will be rasterized
1855+
Set zorder value below which artists will be rasterized. Set
1856+
to `None` to disable rasterizing of artists below a particular
1857+
zorder.
18561858
"""
18571859
self._rasterization_zorder = z
18581860

@@ -2029,7 +2031,8 @@ def draw(self, renderer=None, inframe=False):
20292031
# rasterize artists with negative zorder
20302032
# if the minimum zorder is negative, start rasterization
20312033
rasterization_zorder = self._rasterization_zorder
2032-
if len(dsu) > 0 and dsu[0][0] < rasterization_zorder:
2034+
if (rasterization_zorder is not None and
2035+
len(dsu) > 0 and dsu[0][0] < rasterization_zorder):
20332036
renderer.start_rasterizing()
20342037
dsu_rasterized = [l for l in dsu if l[0] < rasterization_zorder]
20352038
dsu = [l for l in dsu if l[0] >= rasterization_zorder]
@@ -3972,7 +3975,7 @@ def plot(self, *args, **kwargs):
39723975
39733976
plot(x, y, color='green', linestyle='dashed', marker='o',
39743977
markerfacecolor='blue', markersize=12).
3975-
3978+
39763979
See :class:`~matplotlib.lines.Line2D` for details.
39773980
39783981
The kwargs are :class:`~matplotlib.lines.Line2D` properties:
@@ -7073,7 +7076,7 @@ def imshow(self, X, cmap=None, norm=None, aspect=None,
70737076
**Example:**
70747077
70757078
.. plot:: mpl_examples/pylab_examples/image_demo.py
7076-
7079+
70777080
"""
70787081

70797082
if not self._hold: self.cla()
@@ -7418,7 +7421,7 @@ def pcolormesh(self, *args, **kwargs):
74187421
74197422
If ``'None'``, edges will not be visible.
74207423
7421-
If ``'face'``, edges will have the same color as the faces.
7424+
If ``'face'``, edges will have the same color as the faces.
74227425
74237426
An mpl color or sequence of colors will set the edge color
74247427

0 commit comments

Comments
 (0)
0