Skip to content
Merged
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
8 changes: 8 additions & 0 deletions lib/matplotlib/axes/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2544,6 +2544,10 @@ def set_xscale(self, value, **kwargs):
Different kwargs are accepted, depending on the scale:
%(scale_docs)s
"""
# If the scale is being set to log, clip nonposx to prevent headaches
# around zero
if value.lower() == 'log' and 'nonposx' not in kwargs.keys():
kwargs['nonposx'] = 'clip'
self.xaxis._set_scale(value, **kwargs)
self.autoscale_view(scaley=False)
self._update_transScale()
Expand Down Expand Up @@ -2770,6 +2774,10 @@ def set_yscale(self, value, **kwargs):
Different kwargs are accepted, depending on the scale:
%(scale_docs)s
"""
# If the scale is being set to log, clip nonposy to prevent headaches
# around zero
if value.lower() == 'log' and 'nonposy' not in kwargs.keys():
kwargs['nonposy'] = 'clip'
self.yaxis._set_scale(value, **kwargs)
self.autoscale_view(scalex=False)
self._update_transScale()
Expand Down