diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index 99f09156a006..4201c78fda23 100644 --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -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() @@ -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()
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: