18
18
import numpy as np
19
19
import warnings
20
20
21
+ from cbook import mplDeprecation
22
+
21
23
GRIDLINE_INTERPOLATION_STEPS = 180
22
24
23
25
@@ -652,7 +654,7 @@ def __init__(self, axes, pickradius=15):
652
654
self ._minor_tick_kw = dict ()
653
655
654
656
self .cla ()
655
- self .set_scale ('linear' )
657
+ self ._set_scale ('linear' )
656
658
657
659
def set_label_coords (self , x , y , transform = None ):
658
660
"""
@@ -683,6 +685,17 @@ def get_scale(self):
683
685
return self ._scale .name
684
686
685
687
def set_scale (self , value , ** kwargs ):
688
+ """
689
+ Deprecated 1.3.
690
+
691
+ This should 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 ):
686
699
self ._scale = mscale .scale_factory (value , self , ** kwargs )
687
700
self ._scale .set_default_locators_and_formatters (self )
688
701
@@ -982,19 +995,19 @@ def _update_ticks(self, renderer):
982
995
interval_expanded = interval
983
996
else :
984
997
interval_expanded = interval [1 ], interval [0 ]
985
-
998
+
986
999
if hasattr (self , '_get_pixel_distance_along_axis' ):
987
1000
# normally, one does not want to catch all exceptions that could possibly happen, but it
988
1001
# is not clear exactly what exceptions might arise from a user's projection (their rendition
989
1002
# of the Axis object). So, we catch all, with the idea that one would rather potentially
990
1003
# lose a tick from one side of the axis or another, rather than see a stack trace.
991
1004
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 )
993
1006
except :
994
1007
warnings .warn ("Unable to find pixel distance along axis for interval padding; assuming no interval padding needed." )
995
1008
ds1 = 0.0
996
1009
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 )
998
1011
except :
999
1012
warnings .warn ("Unable to find pixel distance along axis for interval padding; assuming no interval padding needed." )
1000
1013
ds2 = 0.0
@@ -1636,11 +1649,11 @@ def _get_pixel_distance_along_axis(self, where, perturb):
1636
1649
Implementing this routine for an axis is optional; if present, it will ensure that no
1637
1650
ticks are lost due to round-off at the extreme ends of an axis.
1638
1651
"""
1639
-
1652
+
1640
1653
# Note that this routine does not work for a polar axis, because of the 1e-10 below. To
1641
1654
# 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.
1644
1657
if self .axes .name == 'polar' :
1645
1658
return 0.0
1646
1659
@@ -1653,7 +1666,7 @@ def _get_pixel_distance_along_axis(self, where, perturb):
1653
1666
pix = trans .transform_point ((where , 1e-10 ))
1654
1667
ptp = transinv .transform_point ((pix [0 ] + perturb , pix [1 ])) # perturb the pixel.
1655
1668
dx = abs (ptp [0 ] - where )
1656
-
1669
+
1657
1670
return dx
1658
1671
1659
1672
def get_label_position (self ):
@@ -1941,7 +1954,7 @@ def _get_pixel_distance_along_axis(self, where, perturb):
1941
1954
ticks are lost due to round-off at the extreme ends of an axis.
1942
1955
"""
1943
1956
1944
- #
1957
+ #
1945
1958
# first figure out the pixel location of the "where" point. We use 1e-10 for the
1946
1959
# x point, so that we remain compatible with log axes.
1947
1960
#
0 commit comments