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 75669ec

Browse filesBrowse files
authored
Merge pull request #10807 from matplotlib/auto-backport-of-pr-10278
Backport PR #10278 on branch v2.2.x
2 parents fe001ef + 165a0a3 commit 75669ec
Copy full SHA for 75669ec

File tree

Expand file treeCollapse file tree

2 files changed

+80
-66
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+80
-66
lines changed

‎lib/matplotlib/axes/_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_axes.py
+78-66Lines changed: 78 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1422,7 +1422,7 @@ def plot(self, *args, **kwargs):
14221422
Returns
14231423
-------
14241424
lines
1425-
A list of `.Line2D` objects that were added.
1425+
A list of `.Line2D` objects representing the plotted data.
14261426
14271427
14281428
See Also
@@ -1565,7 +1565,7 @@ def plot_date(self, x, y, fmt='o', tz=None, xdate=True, ydate=False,
15651565
Returns
15661566
-------
15671567
lines
1568-
A list of `.Line2D` objects that were added to the axes.
1568+
A list of `~.Line2D` objects representing the plotted data.
15691569
15701570
15711571
Other Parameters
@@ -1614,36 +1614,45 @@ def plot_date(self, x, y, fmt='o', tz=None, xdate=True, ydate=False,
16141614
@docstring.dedent_interpd
16151615
def loglog(self, *args, **kwargs):
16161616
"""
1617-
Make a plot with log scaling on both the *x* and *y* axis.
1617+
Make a plot with log scaling on both the x and y axis.
1618+
1619+
Call signatures::
16181620
1619-
:func:`~matplotlib.pyplot.loglog` supports all the keyword
1620-
arguments of :func:`~matplotlib.pyplot.plot` and
1621-
:meth:`matplotlib.axes.Axes.set_xscale` /
1622-
:meth:`matplotlib.axes.Axes.set_yscale`.
1621+
loglog([x], y, [fmt], data=None, **kwargs)
1622+
loglog([x], y, [fmt], [x2], y2, [fmt2], ..., **kwargs)
1623+
1624+
This is just a thin wrapper around `.plot` which additionally changes
1625+
both the x-axis and the y-axis to log scaling. All of the concepts and
1626+
parameters of plot can be used here as well.
1627+
1628+
The additional parameters *basex/y*, *subsx/y* and *nonposx/y* control
1629+
the x/y-axis properties. They are just forwarded to `.Axes.set_xscale`
1630+
and `.Axes.set_yscale`.
16231631
16241632
Parameters
16251633
----------
1626-
basex, basey : scalar
1627-
Base of the x/y logarithm. Must be > 1.
1634+
basex, basey : scalar, optional, default 10
1635+
Base of the x/y logarithm.
16281636
1629-
subsx, subsy : sequence
1630-
The location of the minor x/y ticks; ``None`` defaults to autosubs,
1631-
which depend on the number of decades in the plot;
1632-
see :meth:`matplotlib.axes.Axes.set_xscale` /
1633-
:meth:`matplotlib.axes.Axes.set_yscale` for details.
1637+
subsx, subsy : sequence, optional
1638+
The location of the minor x/y ticks. If *None*, reasonable
1639+
locations are automatically chosen depending on the number of
1640+
decades in the plot.
1641+
See `.Axes.set_xscale` / `.Axes.set_yscale` for details.
16341642
1635-
nonposx, nonposy : ['mask' | 'clip' ]
1643+
nonposx, nonposy : {'mask', 'clip'}, optional, default 'mask'
16361644
Non-positive values in x or y can be masked as invalid, or clipped
16371645
to a very small positive number.
16381646
1647+
Returns
1648+
-------
1649+
lines
1650+
A list of `~.Line2D` objects representing the plotted data.
1651+
16391652
Other Parameters
16401653
----------------
1641-
**kwargs :
1642-
The remaining valid kwargs are :class:`~matplotlib.lines.Line2D`
1643-
properties:
1644-
1645-
%(Line2D)s
1646-
1654+
**kwargs
1655+
All parameters supported by `.plot`.
16471656
"""
16481657
if not self._hold:
16491658
self.cla()
@@ -1669,39 +1678,41 @@ def semilogx(self, *args, **kwargs):
16691678
"""
16701679
Make a plot with log scaling on the x axis.
16711680
1681+
Call signatures::
1682+
1683+
semilogx([x], y, [fmt], data=None, **kwargs)
1684+
semilogx([x], y, [fmt], [x2], y2, [fmt2], ..., **kwargs)
1685+
1686+
This is just a thin wrapper around `.plot` which additionally changes
1687+
the x-axis to log scaling. All of the concepts and parameters of plot
1688+
can be used here as well.
1689+
1690+
The additional parameters *basex*, *subsx* and *nonposx* control the
1691+
x-axis properties. They are just forwarded to `.Axes.set_xscale`.
1692+
16721693
Parameters
16731694
----------
1674-
basex : float, optional
1675-
Base of the x logarithm. The scalar should be larger than 1.
1695+
basex : scalar, optional, default 10
1696+
Base of the x logarithm.
16761697
16771698
subsx : array_like, optional
1678-
The location of the minor xticks; ``None`` defaults to
1679-
autosubs, which depend on the number of decades in the
1680-
plot; see :meth:`~matplotlib.axes.Axes.set_xscale` for
1681-
details.
1699+
The location of the minor xticks. If *None*, reasonable locations
1700+
are automatically chosen depending on the number of decades in the
1701+
plot. See `.Axes.set_xscale` for details.
16821702
1683-
nonposx : string, optional, {'mask', 'clip'}
1684-
Non-positive values in x can be masked as
1685-
invalid, or clipped to a very small positive number.
1703+
nonposx : {'mask', 'clip'}, optional, default 'mask'
1704+
Non-positive values in x can be masked as invalid, or clipped to a
1705+
very small positive number.
16861706
16871707
Returns
16881708
-------
1689-
`~matplotlib.pyplot.plot`
1690-
Log-scaled plot on the x axis.
1709+
lines
1710+
A list of `~.Line2D` objects representing the plotted data.
16911711
16921712
Other Parameters
16931713
----------------
1694-
**kwargs :
1695-
Keyword arguments control the :class:`~matplotlib.lines.Line2D`
1696-
properties:
1697-
1698-
%(Line2D)s
1699-
1700-
Notes
1701-
-----
1702-
This function supports all the keyword arguments of
1703-
:func:`~matplotlib.pyplot.plot` and
1704-
:meth:`matplotlib.axes.Axes.set_xscale`.
1714+
**kwargs
1715+
All parameters supported by `.plot`.
17051716
"""
17061717
if not self._hold:
17071718
self.cla()
@@ -1721,41 +1732,42 @@ def semilogy(self, *args, **kwargs):
17211732
"""
17221733
Make a plot with log scaling on the y axis.
17231734
1735+
Call signatures::
1736+
1737+
semilogy([x], y, [fmt], data=None, **kwargs)
1738+
semilogy([x], y, [fmt], [x2], y2, [fmt2], ..., **kwargs)
1739+
1740+
This is just a thin wrapper around `.plot` which additionally changes
1741+
the y-axis to log scaling. All of the concepts and parameters of plot
1742+
can be used here as well.
1743+
1744+
The additional parameters *basey*, *subsy* and *nonposy* control the
1745+
y-axis properties. They are just forwarded to `.Axes.set_yscale`.
1746+
17241747
Parameters
17251748
----------
1726-
basey : float, optional
1727-
Base of the y logarithm. The scalar should be larger than 1.
1749+
basey : scalar, optional, default 10
1750+
Base of the y logarithm.
17281751
17291752
subsy : array_like, optional
1730-
The location of the minor yticks; ``None`` defaults to
1731-
autosubs, which depend on the number of decades in the
1732-
plot; see :meth:`~matplotlib.axes.Axes.set_yscale` for
1733-
details.
1753+
The location of the minor yticks. If *None*, reasonable locations
1754+
are automatically chosen depending on the number of decades in the
1755+
plot. See `.Axes.set_yscale` for details.
17341756
1735-
nonposy : string, optional, {'mask', 'clip'}
1736-
Non-positive values in *y* can be masked as
1737-
invalid, or clipped to a very small positive number.
1757+
nonposy : {'mask', 'clip'}, optional, default 'mask'
1758+
Non-positive values in y can be masked as invalid, or clipped to a
1759+
very small positive number.
17381760
17391761
Returns
17401762
-------
1741-
`~matplotlib.pyplot.plot`
1742-
Log-scaled plot on the *y* axis.
1763+
lines
1764+
A list of `~.Line2D` objects representing the plotted data.
17431765
17441766
Other Parameters
17451767
----------------
1746-
**kwargs :
1747-
Keyword arguments control the :class:`~matplotlib.lines.Line2D`
1748-
properties:
1749-
1750-
%(Line2D)s
1751-
1752-
Notes
1753-
-----
1754-
This function supports all the keyword arguments of
1755-
:func:`~matplotlib.pyplot.plot` and
1756-
:meth:`matplotlib.axes.Axes.set_yscale`.
1768+
**kwargs
1769+
All parameters supported by `.plot`.
17571770
"""
1758-
17591771
if not self._hold:
17601772
self.cla()
17611773
d = {k: kwargs.pop(k) for k in ['basey', 'subsy', 'nonposy']

‎lib/matplotlib/scale.py

Copy file name to clipboardExpand all lines: lib/matplotlib/scale.py
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,8 @@ def __init__(self, axis, **kwargs):
254254

255255
if nonpos not in ['mask', 'clip']:
256256
raise ValueError("nonposx, nonposy kwarg must be 'mask' or 'clip'")
257+
if base <= 0 or base == 1:
258+
raise ValueError('The log base cannot be <= 0 or == 1')
257259

258260
if base == 10.0:
259261
self._transform = self.Log10Transform(nonpos)

0 commit comments

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