@@ -620,13 +620,13 @@ def __call__(self, x, pos=None):
620620 """
621621 Return the format for tick value *x* at position *pos*.
622622 """
623- if len (self .locs ) == 0 :
623+ if len (self ._locs ) == 0 :
624624 return ''
625625 else :
626- xp = (x - self .offset ) / (10. ** self .orderOfMagnitude )
626+ xp = (x - self .offset ) / (10. ** self ._orderOfMagnitude )
627627 if abs (xp ) < 1e-8 :
628628 xp = 0
629- return self ._format_maybe_minus_and_locale (self .format , xp )
629+ return self ._format_maybe_minus_and_locale (self ._format , xp )
630630
631631 def set_scientific (self , b ):
632632 """
@@ -720,20 +720,20 @@ def get_offset(self):
720720 """
721721 Return scientific notation, plus offset.
722722 """
723- if len (self .locs ) == 0 :
723+ if len (self ._locs ) == 0 :
724724 return ''
725- if self .orderOfMagnitude or self .offset :
725+ if self ._orderOfMagnitude or self .offset :
726726 offsetStr = ''
727727 sciNotStr = ''
728728 if self .offset :
729729 offsetStr = self .format_data (self .offset )
730730 if self .offset > 0 :
731731 offsetStr = '+' + offsetStr
732- if self .orderOfMagnitude :
732+ if self ._orderOfMagnitude :
733733 if self ._usetex or self ._useMathText :
734- sciNotStr = self .format_data (10 ** self .orderOfMagnitude )
734+ sciNotStr = self .format_data (10 ** self ._orderOfMagnitude )
735735 else :
736- sciNotStr = '1e%d' % self .orderOfMagnitude
736+ sciNotStr = '1e%d' % self ._orderOfMagnitude
737737 if self ._useMathText or self ._usetex :
738738 if sciNotStr != '' :
739739 sciNotStr = r'\times\mathdefault{%s}' % sciNotStr
@@ -745,15 +745,15 @@ def get_offset(self):
745745
746746 def set_locs (self , locs ):
747747 # docstring inherited
748- self .locs = locs
749- if len (self .locs ) > 0 :
748+ self ._locs = locs
749+ if len (self ._locs ) > 0 :
750750 if self ._useOffset :
751751 self ._compute_offset ()
752752 self ._set_order_of_magnitude ()
753753 self ._set_format ()
754754
755755 def _compute_offset (self ):
756- locs = self .locs
756+ locs = self ._locs
757757 # Restrict to visible ticks.
758758 vmin , vmax = sorted (self .axis .get_view_interval ())
759759 locs = np .asarray (locs )
@@ -796,19 +796,19 @@ def _set_order_of_magnitude(self):
796796 # if using a numerical offset, find the exponent after applying the
797797 # offset. When lower power limit = upper <> 0, use provided exponent.
798798 if not self ._scientific :
799- self .orderOfMagnitude = 0
799+ self ._orderOfMagnitude = 0
800800 return
801801 if self ._powerlimits [0 ] == self ._powerlimits [1 ] != 0 :
802802 # fixed scaling when lower power limit = upper <> 0.
803- self .orderOfMagnitude = self ._powerlimits [0 ]
803+ self ._orderOfMagnitude = self ._powerlimits [0 ]
804804 return
805805 # restrict to visible ticks
806806 vmin , vmax = sorted (self .axis .get_view_interval ())
807- locs = np .asarray (self .locs )
807+ locs = np .asarray (self ._locs )
808808 locs = locs [(vmin <= locs ) & (locs <= vmax )]
809809 locs = np .abs (locs )
810810 if not len (locs ):
811- self .orderOfMagnitude = 0
811+ self ._orderOfMagnitude = 0
812812 return
813813 if self .offset :
814814 oom = math .floor (math .log10 (vmax - vmin ))
@@ -819,28 +819,28 @@ def _set_order_of_magnitude(self):
819819 else :
820820 oom = math .floor (math .log10 (val ))
821821 if oom <= self ._powerlimits [0 ]:
822- self .orderOfMagnitude = oom
822+ self ._orderOfMagnitude = oom
823823 elif oom >= self ._powerlimits [1 ]:
824- self .orderOfMagnitude = oom
824+ self ._orderOfMagnitude = oom
825825 else :
826- self .orderOfMagnitude = 0
826+ self ._orderOfMagnitude = 0
827827
828828 def _set_format (self ):
829829 # set the format string to format all the ticklabels
830- if len (self .locs ) < 2 :
830+ if len (self ._locs ) < 2 :
831831 # Temporarily augment the locations with the axis end points.
832- _locs = [* self .locs , * self .axis .get_view_interval ()]
832+ _locs = [* self ._locs , * self .axis .get_view_interval ()]
833833 else :
834- _locs = self .locs
835- locs = (np .asarray (_locs ) - self .offset ) / 10. ** self .orderOfMagnitude
834+ _locs = self ._locs
835+ locs = (np .asarray (_locs ) - self .offset ) / 10. ** self ._orderOfMagnitude
836836 loc_range = np .ptp (locs )
837837 # Curvilinear coordinates can yield two identical points.
838838 if loc_range == 0 :
839839 loc_range = np .max (np .abs (locs ))
840840 # Both points might be zero.
841841 if loc_range == 0 :
842842 loc_range = 1
843- if len (self .locs ) < 2 :
843+ if len (self ._locs ) < 2 :
844844 # We needed the end points only for the loc_range calculation.
845845 locs = locs [:- 2 ]
846846 loc_range_oom = int (math .floor (math .log10 (loc_range )))
@@ -854,9 +854,9 @@ def _set_format(self):
854854 else :
855855 break
856856 sigfigs += 1
857- self .format = f'%1.{ sigfigs } f'
857+ self ._format = f'%1.{ sigfigs } f'
858858 if self ._usetex or self ._useMathText :
859- self .format = r'$\mathdefault{%s}$' % self .format
859+ self ._format = r'$\mathdefault{%s}$' % self ._format
860860
861861
862862class LogFormatter (Formatter ):
@@ -1248,7 +1248,7 @@ def set_minor_number(self, minor_number):
12481248 self ._minor_number = minor_number
12491249
12501250 def set_locs (self , locs ):
1251- self .locs = np .array (locs )
1251+ self ._locs = np .array (locs )
12521252 self ._labelled .clear ()
12531253
12541254 if not self ._minor :
@@ -1274,7 +1274,7 @@ def set_locs(self, locs):
12741274 # the previous, and between the ticks and the next one. Ticks
12751275 # with smallest minimum are chosen. As tiebreak, the ticks
12761276 # with smallest sum is chosen.
1277- diff = np .diff (- np .log (1 / self .locs - 1 ))
1277+ diff = np .diff (- np .log (1 / self ._locs - 1 ))
12781278 space_pessimistic = np .minimum (
12791279 np .concatenate (((np .inf ,), diff )),
12801280 np .concatenate ((diff , (np .inf ,))),
@@ -1284,7 +1284,7 @@ def set_locs(self, locs):
12841284 + np .concatenate ((diff , (0 ,)))
12851285 )
12861286 good_minor = sorted (
1287- range (len (self .locs )),
1287+ range (len (self ._locs )),
12881288 key = lambda i : (space_pessimistic [i ], space_sum [i ]),
12891289 )[- self ._minor_number :]
12901290 self ._labelled .update (locs [i ] for i in good_minor )
@@ -1335,11 +1335,11 @@ def __call__(self, x, pos=None):
13351335 exponent = round (math .log10 (1 - x ))
13361336 s = self ._one_minus ("10^{%d}" % exponent )
13371337 elif x < 0.1 :
1338- s = self ._format_value (x , self .locs )
1338+ s = self ._format_value (x , self ._locs )
13391339 elif x > 0.9 :
1340- s = self ._one_minus (self ._format_value (1 - x , 1 - self .locs ))
1340+ s = self ._one_minus (self ._format_value (1 - x , 1 - self ._locs ))
13411341 else :
1342- s = self ._format_value (x , self .locs , sci_notation = False )
1342+ s = self ._format_value (x , self ._locs , sci_notation = False )
13431343 return r"$\mathdefault{%s}$" % s
13441344
13451345 def format_data_short (self , value ):
@@ -1445,18 +1445,18 @@ def __call__(self, x, pos=None):
14451445 If there is no currently offset in the data, it returns the best
14461446 engineering formatting that fits the given argument, independently.
14471447 """
1448- if len (self .locs ) == 0 or self .offset == 0 :
1448+ if len (self ._locs ) == 0 or self .offset == 0 :
14491449 return self .fix_minus (self .format_data (x ))
14501450 else :
1451- xp = (x - self .offset ) / (10. ** self .orderOfMagnitude )
1451+ xp = (x - self .offset ) / (10. ** self ._orderOfMagnitude )
14521452 if abs (xp ) < 1e-8 :
14531453 xp = 0
14541454 return self ._format_maybe_minus_and_locale (self ._format , xp )
14551455
14561456 def set_locs (self , locs ):
14571457 # docstring inherited
1458- self .locs = locs
1459- if len (self .locs ) > 0 :
1458+ self ._locs = locs
1459+ if len (self ._locs ) > 0 :
14601460 vmin , vmax = sorted (self .axis .get_view_interval ())
14611461 if self ._useOffset :
14621462 self ._compute_offset ()
@@ -1470,25 +1470,25 @@ def set_locs(self, locs):
14701470 # value:
14711471 self .offset = round ((vmin + vmax )/ 2 , 3 )
14721472 # Use log1000 to use engineers' oom standards
1473- self .orderOfMagnitude = math .floor (math .log (vmax - vmin , 1000 ))* 3
1473+ self ._orderOfMagnitude = math .floor (math .log (vmax - vmin , 1000 ))* 3
14741474 self ._set_format ()
14751475
14761476 # Simplify a bit ScalarFormatter.get_offset: We always want to use
14771477 # self.format_data. Also we want to return a non-empty string only if there
1478- # is an offset, no matter what is self.orderOfMagnitude . If there _is_ an
1479- # offset, self.orderOfMagnitude is consulted. This behavior is verified
1478+ # is an offset, no matter what is self._orderOfMagnitude . If there _is_ an
1479+ # offset, self._orderOfMagnitude is consulted. This behavior is verified
14801480 # in `test_ticker.py`.
14811481 def get_offset (self ):
14821482 # docstring inherited
1483- if len (self .locs ) == 0 :
1483+ if len (self ._locs ) == 0 :
14841484 return ''
14851485 if self .offset :
14861486 offsetStr = ''
14871487 if self .offset :
14881488 offsetStr = self .format_data (self .offset )
14891489 if self .offset > 0 :
14901490 offsetStr = '+' + offsetStr
1491- sciNotStr = self .format_data (10 ** self .orderOfMagnitude )
1491+ sciNotStr = self .format_data (10 ** self ._orderOfMagnitude )
14921492 if self ._useMathText or self ._usetex :
14931493 if sciNotStr != '' :
14941494 sciNotStr = r'\times%s' % sciNotStr
@@ -1800,8 +1800,8 @@ class FixedLocator(Locator):
18001800 """
18011801
18021802 def __init__ (self , locs , nbins = None ):
1803- self .locs = np .asarray (locs )
1804- _api .check_shape ((None ,), locs = self .locs )
1803+ self ._locs = np .asarray (locs )
1804+ _api .check_shape ((None ,), locs = self ._locs )
18051805 self .nbins = max (nbins , 2 ) if nbins is not None else None
18061806
18071807 def set_params (self , nbins = None ):
@@ -1821,11 +1821,11 @@ def tick_values(self, vmin, vmax):
18211821 Because the values are fixed, *vmin* and *vmax* are not used.
18221822 """
18231823 if self .nbins is None :
1824- return self .locs
1825- step = max (int (np .ceil (len (self .locs ) / self .nbins )), 1 )
1826- ticks = self .locs [::step ]
1824+ return self ._locs
1825+ step = max (int (np .ceil (len (self ._locs ) / self .nbins )), 1 )
1826+ ticks = self ._locs [::step ]
18271827 for i in range (1 , step ):
1828- ticks1 = self .locs [i ::step ]
1828+ ticks1 = self ._locs [i ::step ]
18291829 if np .abs (ticks1 ).min () < np .abs (ticks ).min ():
18301830 ticks = ticks1
18311831 return self .raise_if_exceeds (ticks )
0 commit comments