1818import numpy as np
1919import warnings
2020
21+ from matplotlib import MatplotlibDeprecationWarning as mplDeprecation
22+
2123GRIDLINE_INTERPOLATION_STEPS = 180
2224
2325
@@ -652,7 +654,7 @@ def __init__(self, axes, pickradius=15):
652654 self ._minor_tick_kw = dict ()
653655
654656 self .cla ()
655- self .set_scale ('linear' )
657+ self ._set_scale ('linear' )
656658
657659 def set_label_coords (self , x , y , transform = None ):
658660 """
@@ -683,6 +685,17 @@ def get_scale(self):
683685 return self ._scale .name
684686
685687 def set_scale (self , value , ** kwargs ):
688+ """
689+ Deprecatted 1.3.
690+
691+ This sholud be a private function (moved to _set_scale)
692+ """
693+ warnings .warn ("This function has been made private and moved"
694+ "to `_set_scale`. This wrapper function will be "
695+ "removed in 1.4" , mplDeprecation )
696+ self ._set_scale (value , ** kwargs )
697+
698+ def _set_scale (self , value , ** kwargs ):
686699 self ._scale = mscale .scale_factory (value , self , ** kwargs )
687700 self ._scale .set_default_locators_and_formatters (self )
688701
@@ -982,19 +995,19 @@ def _update_ticks(self, renderer):
982995 interval_expanded = interval
983996 else :
984997 interval_expanded = interval [1 ], interval [0 ]
985-
998+
986999 if hasattr (self , '_get_pixel_distance_along_axis' ):
9871000 # normally, one does not want to catch all exceptions that could possibly happen, but it
9881001 # is not clear exactly what exceptions might arise from a user's projection (their rendition
9891002 # of the Axis object). So, we catch all, with the idea that one would rather potentially
9901003 # lose a tick from one side of the axis or another, rather than see a stack trace.
9911004 try :
992- ds1 = self ._get_pixel_distance_along_axis (interval_expanded [0 ], - 0.5 )
1005+ ds1 = self ._get_pixel_distance_along_axis (interval_expanded [0 ], - 0.5 )
9931006 except :
9941007 warnings .warn ("Unable to find pixel distance along axis for interval padding; assuming no interval padding needed." )
9951008 ds1 = 0.0
9961009 try :
997- ds2 = self ._get_pixel_distance_along_axis (interval_expanded [1 ], + 0.5 )
1010+ ds2 = self ._get_pixel_distance_along_axis (interval_expanded [1 ], + 0.5 )
9981011 except :
9991012 warnings .warn ("Unable to find pixel distance along axis for interval padding; assuming no interval padding needed." )
10001013 ds2 = 0.0
@@ -1636,11 +1649,11 @@ def _get_pixel_distance_along_axis(self, where, perturb):
16361649 Implementing this routine for an axis is optional; if present, it will ensure that no
16371650 ticks are lost due to round-off at the extreme ends of an axis.
16381651 """
1639-
1652+
16401653 # Note that this routine does not work for a polar axis, because of the 1e-10 below. To
16411654 # do things correctly, we need to use rmax instead of 1e-10 for a polar axis. But
1642- # since we do not have that kind of information at this point, we just don't try to
1643- # pad anything for the theta axis of a polar plot.
1655+ # since we do not have that kind of information at this point, we just don't try to
1656+ # pad anything for the theta axis of a polar plot.
16441657 if self .axes .name == 'polar' :
16451658 return 0.0
16461659
@@ -1653,7 +1666,7 @@ def _get_pixel_distance_along_axis(self, where, perturb):
16531666 pix = trans .transform_point ((where , 1e-10 ))
16541667 ptp = transinv .transform_point ((pix [0 ] + perturb , pix [1 ])) # perturb the pixel.
16551668 dx = abs (ptp [0 ] - where )
1656-
1669+
16571670 return dx
16581671
16591672 def get_label_position (self ):
@@ -1941,7 +1954,7 @@ def _get_pixel_distance_along_axis(self, where, perturb):
19411954 ticks are lost due to round-off at the extreme ends of an axis.
19421955 """
19431956
1944- #
1957+ #
19451958 # first figure out the pixel location of the "where" point. We use 1e-10 for the
19461959 # x point, so that we remain compatible with log axes.
19471960 #
0 commit comments