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

Skip to content

Commit 5af9751

Browse files
committed
Add discouraged admonitions
The [*Discouraged*] prefix in the summary line is added in analogy to the [*Deprecated*] prefix we add automatically. We do this so that these "labels" are prominently visible also in summary overviews of the functions in the docs. Since we rarely discourage whole functions, for now I just do this manually.
1 parent ecba9d2 commit 5af9751

File tree

5 files changed

+20
-13
lines changed

5 files changed

+20
-13
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1670,7 +1670,7 @@ def plot(self, *args, scalex=True, scaley=True, data=None, **kwargs):
16701670
def plot_date(self, x, y, fmt='o', tz=None, xdate=True, ydate=False,
16711671
**kwargs):
16721672
"""
1673-
Plot coercing the axis to treat floats as dates.
1673+
[*Discouraged*] Plot coercing the axis to treat floats as dates.
16741674
16751675
.. admonition:: Discouraged
16761676

lib/matplotlib/axes/_base.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2128,19 +2128,23 @@ def get_lines(self):
21282128

21292129
def get_xaxis(self):
21302130
"""
2131-
Return the XAxis instance.
2131+
[*Discouraged*] Return the XAxis instance.
21322132
2133-
The use of this function is discouraged. You should instead directly
2134-
access the attribute ``ax.xaxis``.
2133+
.. admonition:: Discouraged
2134+
2135+
The use of this function is discouraged. You should instead
2136+
directly access the attribute ``ax.xaxis``.
21352137
"""
21362138
return self.xaxis
21372139

21382140
def get_yaxis(self):
21392141
"""
2140-
Return the YAxis instance.
2142+
[*Discouraged*] Return the YAxis instance.
2143+
2144+
.. admonition:: Discouraged
21412145
2142-
The use of this function is discouraged. You should instead directly
2143-
access the attribute ``ax.yaxis``.
2146+
The use of this function is discouraged. You should instead
2147+
directly access the attribute ``ax.yaxis``.
21442148
"""
21452149
return self.yaxis
21462150

lib/matplotlib/axis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1851,7 +1851,7 @@ def _format_with_dict(tickd, x, pos):
18511851

18521852
def set_ticklabels(self, ticklabels, *, minor=False, **kwargs):
18531853
r"""
1854-
Set the text values of the tick labels.
1854+
[*Discouraged*] Set the text values of the tick labels.
18551855
18561856
.. admonition:: Discouraged
18571857

lib/matplotlib/colorbar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,7 @@ def get_ticks(self, minor=False):
895895
def set_ticklabels(self, ticklabels, update_ticks=True, *, minor=False,
896896
**kwargs):
897897
"""
898-
Set tick labels.
898+
[*Discouraged*] Set tick labels.
899899
900900
.. admonition:: Discouraged
901901

lib/matplotlib/figure.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -973,7 +973,7 @@ def clear(self, keep_observers=False):
973973
# synonym for `clear`.
974974
def clf(self, keep_observers=False):
975975
"""
976-
Alias for the `clear()` method.
976+
[*Discouraged*] Alias for the `clear()` method.
977977
978978
.. admonition:: Discouraged
979979
@@ -2689,7 +2689,8 @@ def get_tight_layout(self):
26892689
pending=True)
26902690
def set_tight_layout(self, tight):
26912691
"""
2692-
Set whether and how `.tight_layout` is called when drawing.
2692+
[*Discouraged*] Set whether and how `.tight_layout` is called when
2693+
drawing.
26932694
26942695
.. admonition:: Discouraged
26952696
@@ -2722,8 +2723,10 @@ def get_constrained_layout(self):
27222723
pending=True)
27232724
def set_constrained_layout(self, constrained):
27242725
"""
2725-
Set whether ``constrained_layout`` is used upon drawing. If None,
2726-
:rc:`figure.constrained_layout.use` value will be used.
2726+
[*Discouraged*] Set whether ``constrained_layout`` is used upon
2727+
drawing.
2728+
2729+
If None, :rc:`figure.constrained_layout.use` value will be used.
27272730
27282731
When providing a dict containing the keys ``w_pad``, ``h_pad``
27292732
the default ``constrained_layout`` paddings will be

0 commit comments

Comments
 (0)