8000 change property updates via name · rmorshea/matplotlib@4cd90a3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4cd90a3

Browse files
committed
change property updates via name
1 parent 6ecbe46 commit 4cd90a3

31 files changed

+148
-119
lines changed

TODO.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@
5252
6.0 : pickable
5353
6.0 : clipbox
5454
6.0 : clippath
55+
6.0 : clipon
56+
6.0 : url
57+
6.0 : gid
5558

56-
0.0 : clipon
5759
0.0 : label
5860
0.0 : picker
5961
0.0 : contains

examples/api/demo_affine_image.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def imshow_affine(ax, z, *kl, **kwargs):
3939
Z = get_image()
4040
im1 = imshow_affine(ax1, Z, interpolation='none', cmap=cm.jet,
4141
origin='lower',
42-
extent=[-2, 4, -3, 2], clip_on=True)
42+
extent=[-2, 4, -3, 2], clipon=True)
4343

4444
trans_data2 = mtransforms.Affine2D().rotate_deg(30) + ax1.transData
4545
im1.set_transform(trans_data2)
@@ -58,7 +58,7 @@ def imshow_affine(ax, z, *kl, **kwargs):
5858

5959
im2 = ax2.imshow(Z, interpolation='none', cmap=cm.jet,
6060
origin='lower',
61-
extent=[-2, 4, -3, 2], clip_on=True)
61+
extent=[-2, 4, -3, 2], clipon=True)
6262
im2._image_skew_coordinate = (3, -2)
6363

6464
plt.show()

examples/pylab_examples/annotation_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
arrowprops=dict(facecolor='black', shrink=0.05),
133133
horizontalalignment='left',
134134
verticalalignment='bottom',
135-
clip_on=True, # clip to the axes bounding box
135+
clipon=True, # clip to the axes bounding box
136136
)
137137

138138
ax.set_xlim(-20, 20)

examples/pylab_examples/broken_axis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
d = .015 # how big to make the diagonal lines in axes coordinates
4747
# arguments to pass plot, just so we don't keep repeating them
48-
kwargs = dict(transform=ax.transAxes, color='k', clip_on=False)
48+
kwargs = dict(transform=ax.transAxes, color='k', clipon=False)
4949
ax.plot((-d, +d), (-d, +d), **kwargs) # top-left diagonal
5050
ax.plot((1 - d, 1 + d), (-d, +d), **kwargs) # top-right diagonal
5151

examples/pylab_examples/demo_bboximage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
bbox_image = BboxImage(txt.get_window_extent,
1515
norm=None,
1616
origin=None,
17-
clip_on=False,
17+
clipon=False,
1818
**kwargs
1919
)
2020
a = np.arange(256).reshape(1, 256)/256.

examples/pylab_examples/image_clip_path.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
im = plt.imshow(Z, interpolation='bilinear', cmap=cm.gray,
2121
origin='lower', extent=[-3, 3, -3, 3],
22-
clip_path=patch, clip_on=True)
22+
clip_path=patch, clipon=True)
2323
im.set_clip_path(patch)
2424

2525
plt.show()

examples/pylab_examples/set_and_get.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
alpha = 1.0
4949
antialiased = True
5050
c = b
51-
clip_on = True
51+
clipon = True
5252
color = b
5353
... long listing skipped ...
5454

examples/pylab_examples/spine_placement_demo.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,19 +83,19 @@ def adjust_spines(ax, spines):
8383
y = 2*np.sin(x)
8484

8585
ax = fig.add_subplot(2, 2, 1)
86-
ax.plot(x, y, clip_on=False)
86+
ax.plot(x, y, clipon=False)
8787
adjust_spines(ax, ['left'])
8888

8989
ax = fig.add_subplot(2, 2, 2)
90-
ax.plot(x, y, clip_on=False)
90+
ax.plot(x, y, clipon=False)
9191
adjust_spines(ax, [])
9292

9393
ax = fig.add_subplot(2, 2, 3)
94-
ax.plot(x, y, clip_on=False)
94+
ax.plot(x, y, clipon=False)
9595
adjust_spines(ax, ['left', 'bottom'])
9696

9797
ax = fig.add_subplot(2, 2, 4)
98-
ax.plot(x, y, clip_on=False)
98+
ax.plot(x, y, clipon=False)
9999
adjust_spines(ax, ['bottom'])
100100

101101
plt.show()

examples/pylab_examples/usetex_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
horizontalalignment='left',
4646
verticalalignment='center',
4747
rotation=90,
48-
clip_on=False)
48+
clipon=False)
4949
plt.text(1.01, -0.02, "-1", {'color': 'k', 'fontsize': 20})
5050
plt.text(1.01, 0.98, "1", {'color': 'k', 'fontsize': 20})
5151
plt.text(1.01, 0.48, "0", {'color': 'k', 'fontsize': 20})

lib/matplotlib/artist.py

Lines changed: 50 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,22 @@ def _clippath_changed(self, name, new, old):
203203
self.pchanged()
204204
self.stale = True
205205

206+
clipon = Bool(True)
207+
208+
def _clipon_changed(self, name, old, new):
209+
self.pchanged()
210+
self.stale = True
211+
212+
# label = Unicode('', allow_none=True)
213+
214+
# def _label_changed(self, name, old, new):
215+
# self.pchanged()
216+
# self.stale = True
217+
206218
url = Unicode(allow_none=True)
207219

220+
gid = Unicode(allow_none=True)
221+
208222
def __init__(self):
209223
# self._stale = True
210224
# self._axes = None
@@ -219,7 +233,7 @@ def __init__(self):
219233
# self._alpha = None
220234
# self.clipbox = None
221235
# self._clippath = None
222-
self._clipon = True
236+
# self._clipon = True
223237
self._label = ''
224238
self._picker = None
225239
self._contains = None
@@ -236,7 +250,7 @@ def __init__(self):
236250
# pass
237251
self._remove_method = None
238252
# self._url = None
239-
self._gid = None
253+
# self._gid = None
240254
self._snap = None
241255
self._sketch = rcParams['path.sketch']
242256
self._path_effects = rcParams['path.effects']
@@ -638,19 +652,21 @@ def is_figure_set(self):
638652
# """
639653
# self._url = url
640654

641-
def get_gid(self):
642-
"""
643-
Returns the group id
644-
"""
645-
return self._gid
655+
#!DEPRECATED
656+
# def get_gid(self):
657+
# """
658+
# Returns the group id
659+
# """
660+
# return self._gid
646661

647-
def set_gid(self, gid):
648-
"""
649-
Sets the (group) id for the artist
662+
#!DEPRECATED
663+
# def set_gid(self, gid):
664+
# """
665+
# Sets the (group) id for the artist
650666

651-
ACCEPTS: an id string
652-
"""
653-
self._gid = gid
667+
# ACCEPTS: an id string
668+
# """
669+
# self._gid = gid
654670

655671
def get_snap(self):
656672
"""
@@ -837,9 +853,10 @@ def set_clip_path(self, path, transform=None):
837853
# "Return the artist's animated state"
838854
# return self._animated
839855

840-
def get_clip_on(self):
841-
'Return whether artist uses clipping'
842-
return self._clipon
856+
#!DEPRECATED
857+
# def get_clip_on(self):
858+
# 'Return whether artist uses clipping'
859+
# return self._clipon
843860

844861
#!DEPRECATED
845862
# def get_clip_box(self):
@@ -861,24 +878,25 @@ def get_transformed_clip_path_and_affine(self):
861878
return self.clippath.get_transformed_path_and_affine()
862879
return None, None
863880

864-
def set_clip_on(self, b):
865-
"""
866-
Set whether artist uses clipping.
881+
#!DEPRECATED
882+
# def set_clip_on(self, b):
883+
# """
884+
# Set whether artist uses clipping.
867885

868-
When False artists will be visible out side of the axes which
869-
can lead to unexpected results.
886+
# When False artists will be visible out side of the axes which
887+
# can lead to unexpected results.
870888

871-
ACCEPTS: [True | False]
872-
"""
873-
self._clipon = b
874-
# This may result in the callbacks being hit twice, but ensures they
875-
# are hit at least once
876-
self.pchanged()
877-
self.stale = True
889+
# ACCEPTS: [True | False]
890+
# """
891+
# self._clipon = b
892+
# # This may result in the callbacks being hit twice, but ensures they
893+
# # are hit at least once
894+
# self.pchanged()
895+
# self.stale = True
878896

879897
def _set_gc_clip(self, gc):
880898
'Set the clip properly for the gc'
881-
if self._clipon:
899+
if self.clipon:
882900
if self.clipbox is not None:
883901
gc.set_clip_rectangle(self.clipbox)
884902
gc.set_clip_path(self.clippath)
@@ -985,12 +1003,14 @@ def update(self, props):
9851003
self.pchanged()
9861004
self.stale = True
9871005

1006+
#!DEPRECATED
9881007
def get_label(self):
9891008
"""
9901009
Get the label used for this artist in the legend.
9911010
"""
9921011
return self._label
9931012

1013+
#!DEPRECATED
9941014
def set_label(self, s):
9951015
"""
9961016
Set the label to *s* for auto legend.
@@ -1028,7 +1048,7 @@ def update_from(self, other):
10281048
self.private('visible', other.private('visible'))
10291049
self.private('alpha',other.alpha)
10301050
self.private('clipbox', other.clipbox)
1031-
self._clipon = other._clipon
1051+
self.private('clipon', other.clipon)
10321052
self.private('clippath', other.clippath)
10331053
self._label = other._label
10341054
self._sketch = other._sketch

0 commit comments

Comments
 (0)
0