1010import numpy as np
1111
1212import matplotlib as mpl
13- from matplotlib import cbook , rcParams
13+ from matplotlib import cbook
1414from matplotlib .cbook import _OrderedSet , _check_1d , index_of
1515from matplotlib import docstring
1616import matplotlib .colors as mcolors
@@ -106,7 +106,7 @@ def _process_plot_format(fmt):
106106 'Unrecognized character %c in format string' % c )
107107
108108 if linestyle is None and marker is None :
109- linestyle = rcParams ['lines.linestyle' ]
109+ linestyle = mpl . rcParams ['lines.linestyle' ]
110110 if linestyle is None :
111111 linestyle = 'None'
112112 if marker is None :
@@ -142,7 +142,7 @@ def __setstate__(self, state):
142142 def set_prop_cycle (self , * args , ** kwargs ):
143143 # Can't do `args == (None,)` as that crashes cycler.
144144 if not (args or kwargs ) or (len (args ) == 1 and args [0 ] is None ):
145- prop_cycler = rcParams ['axes.prop_cycle' ]
145+ prop_cycler = mpl . rcParams ['axes.prop_cycle' ]
146146 else :
147147 prop_cycler = cycler (* args , ** kwargs )
148148
@@ -453,10 +453,10 @@ def __init__(self, fig, rect,
453453 # this call may differ for non-sep axes, e.g., polar
454454 self ._init_axis ()
455455 if facecolor is None :
456- facecolor = rcParams ['axes.facecolor' ]
456+ facecolor = mpl . rcParams ['axes.facecolor' ]
457457 self ._facecolor = facecolor
458458 self ._frameon = frameon
459- self .set_axisbelow (rcParams ['axes.axisbelow' ])
459+ self .set_axisbelow (mpl . rcParams ['axes.axisbelow' ])
460460
461461 self ._rasterization_zorder = None
462462 self .cla ()
@@ -483,6 +483,7 @@ def __init__(self, fig, rect,
483483 self ._ycid = self .yaxis .callbacks .connect (
484484 'units finalize' , lambda : self ._on_units_changed (scaley = True ))
485485
486+ rcParams = mpl .rcParams
486487 self .tick_params (
487488 top = rcParams ['xtick.top' ] and rcParams ['xtick.minor.top' ],
488489 bottom = rcParams ['xtick.bottom' ] and rcParams ['xtick.minor.bottom' ],
@@ -697,7 +698,7 @@ def get_xaxis_text1_transform(self, pad_points):
697698 class, and is meant to be overridden by new kinds of projections that
698699 may need to place axis elements in different locations.
699700 """
700- labels_align = rcParams ["xtick.alignment" ]
701+ labels_align = mpl . rcParams ["xtick.alignment" ]
701702 return (self .get_xaxis_transform (which = 'tick1' ) +
702703 mtransforms .ScaledTranslation (0 , - 1 * pad_points / 72 ,
703704 self .figure .dpi_scale_trans ),
@@ -723,7 +724,7 @@ def get_xaxis_text2_transform(self, pad_points):
723724 class, and is meant to be overridden by new kinds of projections that
724725 may need to place axis elements in different locations.
725726 """
726- labels_align = rcParams ["xtick.alignment" ]
727+ labels_align = mpl . rcParams ["xtick.alignment" ]
727728 return (self .get_xaxis_transform (which = 'tick2' ) +
728729 mtransforms .ScaledTranslation (0 , pad_points / 72 ,
729730 self .figure .dpi_scale_trans ),
@@ -773,7 +774,7 @@ def get_yaxis_text1_transform(self, pad_points):
773774 class, and is meant to be overridden by new kinds of projections that
774775 may need to place axis elements in different locations.
775776 """
776- labels_align = rcParams ["ytick.alignment" ]
777+ labels_align = mpl . rcParams ["ytick.alignment" ]
777778 return (self .get_yaxis_transform (which = 'tick1' ) +
778779 mtransforms .ScaledTranslation (- 1 * pad_points / 72 , 0 ,
779780 self .figure .dpi_scale_trans ),
@@ -799,7 +800,7 @@ def get_yaxis_text2_transform(self, pad_points):
799800 class, and is meant to be overridden by new kinds of projections that
800801 may need to place axis elements in different locations.
801802 """
802- labels_align = rcParams ["ytick.alignment" ]
803+ labels_align = mpl . rcParams ["ytick.alignment" ]
803804 return (self .get_yaxis_transform (which = 'tick2' ) +
804805 mtransforms .ScaledTranslation (pad_points / 72 , 0 ,
805806 self .figure .dpi_scale_trans ),
@@ -1005,26 +1006,26 @@ def cla(self):
10051006 except TypeError :
10061007 pass
10071008 # update the minor locator for x and y axis based on rcParams
1008- if rcParams ['xtick.minor.visible' ]:
1009+ if mpl . rcParams ['xtick.minor.visible' ]:
10091010 self .xaxis .set_minor_locator (mticker .AutoMinorLocator ())
10101011
1011- if rcParams ['ytick.minor.visible' ]:
1012+ if mpl . rcParams ['ytick.minor.visible' ]:
10121013 self .yaxis .set_minor_locator (mticker .AutoMinorLocator ())
10131014
10141015 if self ._sharex is None :
10151016 self ._autoscaleXon = True
10161017 if self ._sharey is None :
10171018 self ._autoscaleYon = True
1018- self ._xmargin = rcParams ['axes.xmargin' ]
1019- self ._ymargin = rcParams ['axes.ymargin' ]
1019+ self ._xmargin = mpl . rcParams ['axes.xmargin' ]
1020+ self ._ymargin = mpl . rcParams ['axes.ymargin' ]
10201021 self ._tight = None
10211022 self ._use_sticky_edges = True
10221023 self ._update_transScale () # needed?
10231024
10241025 self ._get_lines = _process_plot_var_args (self )
10251026 self ._get_patches_for_fill = _process_plot_var_args (self , 'fill' )
10261027
1027- self ._gridOn = rcParams ['axes.grid' ]
1028+ self ._gridOn = mpl . rcParams ['axes.grid' ]
10281029 self .lines = []
10291030 self .patches = []
10301031 self .texts = []
@@ -1039,11 +1040,11 @@ def cla(self):
10391040 self .containers = []
10401041
10411042 self .grid (False ) # Disable grid on init to use rcParameter
1042- self .grid (self ._gridOn , which = rcParams ['axes.grid.which' ],
1043- axis = rcParams ['axes.grid.axis' ])
1043+ self .grid (self ._gridOn , which = mpl . rcParams ['axes.grid.which' ],
1044+ axis = mpl . rcParams ['axes.grid.axis' ])
10441045 props = font_manager .FontProperties (
1045- size = rcParams ['axes.titlesize' ],
1046- weight = rcParams ['axes.titleweight' ])
1046+ size = mpl . rcParams ['axes.titlesize' ],
1047+ weight = mpl . rcParams ['axes.titleweight' ])
10471048
10481049 self .title = mtext .Text (
10491050 x = 0.5 , y = 1.0 , text = '' ,
@@ -1062,7 +1063,7 @@ def cla(self):
10621063 verticalalignment = 'baseline' ,
10631064 horizontalalignment = 'right' ,
10641065 )
1065- title_offset_points = rcParams ['axes.titlepad' ]
1066+ title_offset_points = mpl . rcParams ['axes.titlepad' ]
10661067 # refactor this out so it can be called in ax.set_title if
10671068 # pad argument used...
10681069 self ._set_title_offset_trans (title_offset_points )
@@ -1121,7 +1122,7 @@ def set_facecolor(self, color):
11211122
11221123 def _set_title_offset_trans (self , title_offset_points ):
11231124 """
1124- Set the offset for the title either from rcParams[' axes.titlepad']
1125+ Set the offset for the title either from :rc:` axes.titlepad`
11251126 or from set_title kwarg ``pad``.
11261127 """
11271128 self .titleOffsetTrans = mtransforms .ScaledTranslation (
0 commit comments