Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7d73e9c

Browse filesBrowse files
committed
And some more.
1 parent 8cc0c57 commit 7d73e9c
Copy full SHA for 7d73e9c

File tree

Expand file treeCollapse file tree

2 files changed

+103
-64
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+103
-64
lines changed

‎lib/matplotlib/artist.py

Copy file name to clipboardExpand all lines: lib/matplotlib/artist.py
+102-63Lines changed: 102 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -307,9 +307,8 @@ def set_transform(self, t):
307307
Parameters
308308
----------
309309
t : `~.Transform`
310-
311-
..
312-
ACCEPTS: `~.Transform`
310+
..
311+
ACCEPTS: `~.Transform`
313312
"""
314313
self._transform = t
315314
self._transformSet = True
@@ -377,7 +376,11 @@ def set_contains(self, picker):
377376
and *props* is a dictionary of properties you want returned
378377
with the contains test.
379378
380-
ACCEPTS: a callable function
379+
Parameters
380+
----------
381+
picker : callable
382+
..
383+
ACCEPTS: a callable function
381384
"""
382385
self._contains = picker
383386

@@ -454,46 +457,51 @@ def set_picker(self, picker):
454457
artist, return *hit=True* and props is a dictionary of
455458
properties you want added to the PickEvent attributes.
456459
457-
ACCEPTS: [None|float|boolean|callable]
460+
Parameters
461+
----------
462+
picker : None or bool or float or callable
463+
..
464+
ACCEPTS: [None | bool | float | callable]
458465
"""
459466
self._picker = picker
460467

461468
def get_picker(self):
462-
'Return the picker object used by this artist'
469+
"""Return the picker object used by this artist."""
463470
return self._picker
464471

465472
def is_figure_set(self):
466-
"""
467-
Returns True if the artist is assigned to a
468-
:class:`~matplotlib.figure.Figure`.
469-
"""
473+
"""Returns whether the artist is assigned to a `~.Figure`."""
470474
return self.figure is not None
471475

472476
def get_url(self):
473-
"""
474-
Returns the url
475-
"""
477+
"""Returns the url."""
476478
return self._url
477479

478480
def set_url(self, url):
479481
"""
480-
Sets the url for the artist
482+
Sets the url for the artist.
481483
482-
ACCEPTS: a url string
484+
Parameters
485+
----------
486+
url : str
487+
..
488+
ACCEPTS: a url string
483489
"""
484490
self._url = url
485491

486492
def get_gid(self):
487-
"""
488-
Returns the group id
489-
"""
493+
"""Returns the group id."""
490494
return self._gid
491495

492496
def set_gid(self, gid):
493497
"""
494-
Sets the (group) id for the artist
498+
Sets the (group) id for the artist.
495499
496-
ACCEPTS: an id string
500+
Parameters
501+
----------
502+
gid : str
503+
..
504+
ACCEPTS: an id string
497505
"""
498506
self._gid = gid
499507

@@ -528,8 +536,11 @@ def set_snap(self, snap):
528536
529537
Only supported by the Agg and MacOSX backends.
530538
531-
..
532-
ACCEPTS: Optional[bool]
539+
Parameters
540+
----------
541+
snap : Optional[bool]
542+
..
543+
ACCEPTS: Optional[bool]
533544
"""
534545
self._snap = snap
535546
self.stale = True
@@ -560,9 +571,6 @@ def set_sketch_params(self, scale=None, length=None, randomness=None):
560571
"""
561572
Sets the sketch parameters.
562573
563-
..
564-
ACCEPTS: (scale: float, length: float, randomness: float)
565-
566574
Parameters
567575
----------
568576
@@ -578,6 +586,9 @@ def set_sketch_params(self, scale=None, length=None, randomness=None):
578586
randomness : float, optional
579587
The scale factor by which the length is shrunken or
580588
expanded (default 16.0)
589+
590+
..
591+
ACCEPTS: (scale: float, length: float, randomness: float)
581592
"""
582593
if scale is None:
583594
self._sketch = None
@@ -588,12 +599,11 @@ def set_sketch_params(self, scale=None, length=None, randomness=None):
588599
def set_path_effects(self, path_effects):
589600
"""Set the path effects.
590601
591-
..
592-
ACCEPTS: `~.AbstractPathEffect`
593-
594602
Parameters
595603
----------
596604
path_effects : `~.AbstractPathEffect`
605+
..
606+
ACCEPTS: `~.AbstractPathEffect`
597607
"""
598608
self._path_effects = path_effects
599609
self.stale = True
@@ -602,18 +612,18 @@ def get_path_effects(self):
602612
return self._path_effects
603613

604614
def get_figure(self):
605-
"""
606-
Return the :class:`~matplotlib.figure.Figure` instance the
607-
artist belongs to.
608-
"""
615+
"""Return the `~.Figure` instance the artist belongs to."""
609616
return self.figure
610617

611618
def set_figure(self, fig):
612619
"""
613-
Set the :class:`~matplotlib.figure.Figure` instance the artist
614-
belongs to.
620+
Set the `~.Figure` instance the artist belongs to.
615621
616-
ACCEPTS: a :class:`matplotlib.figure.Figure` instance
622+
Parameters
623+
----------
624+
fig : `~.Figure`
625+
..
626+
ACCEPTS: a `~.Figure` instance
617627
"""
618628
# if this is a no-op just return
619629
if self.figure is fig:
@@ -633,9 +643,13 @@ def set_figure(self, fig):
633643

634644
def set_clip_box(self, clipbox):
635645
"""
636-
Set the artist's clip :class:`~matplotlib.transforms.Bbox`.
646+
Set the artist's clip `~.Bbox`.
637647
638-
ACCEPTS: a :class:`matplotlib.transforms.Bbox` instance
648+
Parameters
649+
----------
650+
clipbox : `~.Bbox`
651+
..
652+
ACCEPTS: a `~.Bbox` instance
639653
"""
640654
self.clipbox = clipbox
641655
self.pchanged()
@@ -656,9 +670,7 @@ def set_clip_path(self, path, transform=None):
656670
this method will set the clipping box to the corresponding rectangle
657671
and set the clipping path to ``None``.
658672
659-
ACCEPTS: [ (:class:`~matplotlib.path.Path`,
660-
:class:`~matplotlib.transforms.Transform`) |
661-
:class:`~matplotlib.patches.Patch` | None ]
673+
ACCEPTS: [(`~matplotlib.path.Path`, `~.Transform`) | `~.Patch` | None]
662674
"""
663675
from matplotlib.patches import Patch, Rectangle
664676

@@ -741,7 +753,11 @@ def set_clip_on(self, b):
741753
When False artists will be visible out side of the axes which
742754
can lead to unexpected results.
743755
744-
ACCEPTS: [True | False]
756+
Parameters
757+
----------
758+
b : bool
759+
..
760+
ACCEPTS: bool
745761
"""
746762
self._clipon = b
747763
# This may result in the callbacks being hit twice, but ensures they
@@ -760,7 +776,7 @@ def _set_gc_clip(self, gc):
760776
gc.set_clip_path(None)
761777

762778
def get_rasterized(self):
763-
"return True if the artist is to be rasterized"
779+
"""Return whether the artist is to be rasterized."""
764780
return self._rasterized
765781

766782
def set_rasterized(self, rasterized):
@@ -769,7 +785,11 @@ def set_rasterized(self, rasterized):
769785
770786
Defaults to None, which implies the backend's default behavior
771787
772-
ACCEPTS: [True | False | None]
788+
Parameters
789+
----------
790+
rasterized : Optional[bool]
791+
..
792+
ACCEPTS: [True | False | None]
773793
"""
774794
if rasterized and not hasattr(self.draw, "_supports_rasterization"):
775795
warnings.warn("Rasterization of '%s' will be ignored" % self)
@@ -783,15 +803,15 @@ def get_agg_filter(self):
783803
def set_agg_filter(self, filter_func):
784804
"""Set the agg filter.
785805
786-
..
787-
ACCEPTS: a filter function, which takes a (m, n, 3) float array and
788-
a dpi value, and returns a (m, n, 3) array
789-
790806
Parameters
791807
----------
792808
filter_func : callable
793809
A filter function, which takes a (m, n, 3) float array and a dpi
794810
value, and returns a (m, n, 3) array.
811+
812+
..
813+
ACCEPTS: a filter function, which takes a (m, n, 3) float array
814+
and a dpi value, and returns a (m, n, 3) array
795815
"""
796816
self._agg_filter = filter_func
797817
self.stale = True
@@ -807,17 +827,25 @@ def set_alpha(self, alpha):
807827
Set the alpha value used for blending - not supported on
808828
all backends.
809829
810-
ACCEPTS: float (0.0 transparent through 1.0 opaque)
830+
Parameters
831+
----------
832+
alpha : float
833+
..
834+
ACCEPTS: float (0.0 transparent through 1.0 opaque)
811835
"""
812836
self._alpha = alpha
813837
self.pchanged()
814838
self.stale = True
815839

816840
def set_visible(self, b):
817841
"""
818-
Set the artist's visiblity.
842+
Set the artist's visibility.
819843
820-
ACCEPTS: [True | False]
844+
Parameters
845+
----------
846+
b : bool
847+
..
848+
ACCEPTS: bool
821849
"""
822850
self._visible = b
823851
self.pchanged()
@@ -827,26 +855,30 @@ def set_animated(self, b):
827855
"""
828856
Set the artist's animation state.
829857
830-
ACCEPTS: [True | False]
858+
Parameters
859+
----------
860+
b : bool
861+
..
862+
ACCEPTS: bool
831863
"""
832864
if self._animated != b:
833865
self._animated = b
834866
self.pchanged()
835867

836868
def update(self, props):
837869
"""
838-
Update the properties of this :class:`Artist` from the
839-
dictionary *prop*.
870+
Update this artist's properties from the dictionary *prop*.
840871
"""
841872
def _update_property(self, k, v):
842-
"""sorting out how to update property (setter or setattr)
873+
"""Sorting out how to update property (setter or setattr).
843874
844875
Parameters
845876
----------
846877
k : str
847878
The name of property to update
848879
v : obj
849880
The value to assign to the property
881+
850882
Returns
851883
-------
852884
ret : obj or None
@@ -877,36 +909,43 @@ def _update_property(self, k, v):
877909
return ret
878910

879911
def get_label(self):
880-
"""
881-
Get the label used for this artist in the legend.
882-
"""
912+
"""Get the label used for this artist in the legend."""
883913
return self._label
884914

885915
def set_label(self, s):
886916
"""
887917
Set the label to *s* for auto legend.
888918
889-
ACCEPTS: string or anything printable with '%s' conversion.
919+
Parameters
920+
----------
921+
s : object
922+
*s* will be converted to a string by calling `str` (`unicode` on
923+
Py2).
924+
925+
..
926+
ACCEPTS: object
890927
"""
891928
if s is not None:
892-
self._label = '%s' % (s, )
929+
self._label = six.text_type(s)
893930
else:
894931
self._label = None
895932
self.pchanged()
896933
self.stale = True
897934

898935
def get_zorder(self):
899-
"""
900-
Return the :class:`Artist`'s zorder.
901-
"""
936+
"""Return the artist's zorder."""
902937
return self.zorder
903938

904939
def set_zorder(self, level):
905940
"""
906941
Set the zorder for the artist. Artists with lower zorder
907942
values are drawn first.
908943
909-
ACCEPTS: any number
944+
Parameters
945+
----------
946+
level : float
947+
..
948+
ACCEPTS: float
910949
"""
911950
self.zorder = level
912951
self.pchanged()

‎lib/matplotlib/tests/test_artist.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_artist.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,4 +245,4 @@ def test_setp():
245245
# Check `file` argument
246246
sio = io.StringIO()
247247
plt.setp(lines1, 'zorder', file=sio)
248-
assert sio.getvalue() == ' zorder: any number \n'
248+
assert sio.getvalue() == ' zorder: float \n'

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.