Skip to content

bugfix: creating patches with transform=None #1326

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 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion boilerplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def boilerplate_gen():
#'spy' : 'sci(%(ret)s)', ### may return image or Line2D
'quiver' : 'sci(%(ret)s)',
'specgram' : 'sci(%(ret)s[-1])',
'streamplot' : 'sci(%(ret)s)',
'streamplot' : 'sci(%(ret)s.lines)',
'tricontour' : 'if %(ret)s._A is not None: sci(%(ret)s)',
'tricontourf': 'if %(ret)s._A is not None: sci(%(ret)s)',
'tripcolor' : 'sci(%(ret)s)',
Expand Down
5 changes: 3 additions & 2 deletions lib/matplotlib/artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,11 @@ def set_transform(self, t):
Set the :class:`~matplotlib.transforms.Transform` instance
used by this artist.

ACCEPTS: :class:`~matplotlib.transforms.Transform` instance
ACCEPTS: :class:`~matplotlib.transforms.Transform` instance, or None
set_transform(None) is equivalent to set_transform(IdentityTransform())
"""
self._transform = t
self._transformSet = t is not None
self._transformSet = True
self.pchanged()

def get_transform(self):
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -6637,7 +6637,7 @@ def stackplot(self, x, *args, **kwargs):

def streamplot(self, x, y, u, v, density=1, linewidth=None, color=None,
cmap=None, norm=None, arrowsize=1, arrowstyle='-|>',
minlength=0.1, transform=None):
minlength=0.1, transform=False):
if not self._hold: self.cla()
stream_container = mstream.streamplot(self, x, y, u, v,
density=density,
Expand Down
8 changes: 4 additions & 4 deletions lib/matplotlib/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import matplotlib.backend_bases as backend_bases
import matplotlib.path as mpath
import matplotlib.mlab as mlab

from matplotlib.transforms import IdentityTransform

class Collection(artist.Artist, cm.ScalarMappable):
"""
Expand Down Expand Up @@ -81,7 +81,7 @@ def __init__(self,
linestyles='solid',
antialiaseds=None,
offsets=None,
transOffset=None,
transOffset=False, # disginguish from None(=IdentityTransform)
norm=None, # optional for ScalarMappable
cmap=None, # ditto
pickradius=5.0,
Expand Down Expand Up @@ -115,7 +115,7 @@ def __init__(self,
if offsets is not None:
offsets = np.asanyarray(offsets)
offsets.shape = (-1, 2) # Make it Nx2
if transOffset is not None:
if transOffset is not False:
self._offsets = offsets
self._transOffset = transOffset
else:
Expand Down Expand Up @@ -159,7 +159,7 @@ def get_transforms(self):
return self._transforms

def get_offset_transform(self):
t = self._transOffset
t = self._transOffset or IdentityTransform()
if (not isinstance(t, transforms.Transform)
and hasattr(t, '_as_mpl_transform')):
t = t._as_mpl_transform(self.axes)
Expand Down
Loading