doc_content
stringlengths
1
386k
doc_id
stringlengths
5
188
set_params(nbins=None)[source] Set parameters within this locator.
matplotlib.ticker_api#matplotlib.ticker.FixedLocator.set_params
tick_values(vmin, vmax)[source] Return the locations of the ticks. Note Because the values are fixed, vmin and vmax are not used in this method.
matplotlib.ticker_api#matplotlib.ticker.FixedLocator.tick_values
classmatplotlib.ticker.FormatStrFormatter(fmt)[source] Bases: matplotlib.ticker.Formatter Use an old-style ('%' operator) format string to format the tick. The format string should have a single variable format (%) in it. It will be applied to the value (not the position) of the tick. Negative numeric values will use a dash not a unicode minus, use mathtext to get a unicode minus by wrappping the format specifier with $ (e.g. "$%g$").
matplotlib.ticker_api#matplotlib.ticker.FormatStrFormatter
classmatplotlib.ticker.Formatter[source] Bases: matplotlib.ticker.TickHelper Create a string based on a tick value and location. staticfix_minus(s)[source] Some classes may want to replace a hyphen for minus with the proper unicode symbol (U+2212) for typographical correctness. This is a helper method to perform such a replacement when it is enabled via rcParams["axes.unicode_minus"] (default: True). format_data(value)[source] Return the full string representation of the value with the position unspecified. format_data_short(value)[source] Return a short string version of the tick value. Defaults to the position-independent long value. format_ticks(values)[source] Return the tick labels for all the ticks at once. get_offset()[source] locs=[] set_locs(locs)[source] Set the locations of the ticks. This method is called before computing the tick labels because some formatters need to know all tick locations to do so.
matplotlib.ticker_api#matplotlib.ticker.Formatter
staticfix_minus(s)[source] Some classes may want to replace a hyphen for minus with the proper unicode symbol (U+2212) for typographical correctness. This is a helper method to perform such a replacement when it is enabled via rcParams["axes.unicode_minus"] (default: True).
matplotlib.ticker_api#matplotlib.ticker.Formatter.fix_minus
format_data(value)[source] Return the full string representation of the value with the position unspecified.
matplotlib.ticker_api#matplotlib.ticker.Formatter.format_data
format_data_short(value)[source] Return a short string version of the tick value. Defaults to the position-independent long value.
matplotlib.ticker_api#matplotlib.ticker.Formatter.format_data_short
format_ticks(values)[source] Return the tick labels for all the ticks at once.
matplotlib.ticker_api#matplotlib.ticker.Formatter.format_ticks
get_offset()[source]
matplotlib.ticker_api#matplotlib.ticker.Formatter.get_offset
locs=[]
matplotlib.ticker_api#matplotlib.ticker.Formatter.locs
set_locs(locs)[source] Set the locations of the ticks. This method is called before computing the tick labels because some formatters need to know all tick locations to do so.
matplotlib.ticker_api#matplotlib.ticker.Formatter.set_locs
classmatplotlib.ticker.FuncFormatter(func)[source] Bases: matplotlib.ticker.Formatter Use a user-defined function for formatting. The function should take in two inputs (a tick value x and a position pos), and return a string containing the corresponding tick label. get_offset()[source] set_offset_string(ofs)[source]
matplotlib.ticker_api#matplotlib.ticker.FuncFormatter
get_offset()[source]
matplotlib.ticker_api#matplotlib.ticker.FuncFormatter.get_offset
set_offset_string(ofs)[source]
matplotlib.ticker_api#matplotlib.ticker.FuncFormatter.set_offset_string
classmatplotlib.ticker.IndexLocator(base, offset)[source] Bases: matplotlib.ticker.Locator Place a tick on every multiple of some base number of points plotted, e.g., on every 5th point. It is assumed that you are doing index plotting; i.e., the axis is 0, len(data). This is mainly useful for x ticks. Place ticks every base data point, starting at offset. set_params(base=None, offset=None)[source] Set parameters within this locator tick_values(vmin, vmax)[source] Return the values of the located ticks given vmin and vmax. Note To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance: >>> print(type(loc)) <type 'Locator'> >>> print(loc()) [1, 2, 3, 4]
matplotlib.ticker_api#matplotlib.ticker.IndexLocator
set_params(base=None, offset=None)[source] Set parameters within this locator
matplotlib.ticker_api#matplotlib.ticker.IndexLocator.set_params
tick_values(vmin, vmax)[source] Return the values of the located ticks given vmin and vmax. Note To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance: >>> print(type(loc)) <type 'Locator'> >>> print(loc()) [1, 2, 3, 4]
matplotlib.ticker_api#matplotlib.ticker.IndexLocator.tick_values
classmatplotlib.ticker.LinearLocator(numticks=None, presets=None)[source] Bases: matplotlib.ticker.Locator Determine the tick locations The first time this function is called it will try to set the number of ticks to make a nice tick partitioning. Thereafter the number of ticks will be fixed so that interactive navigation will be nice Use presets to set locs based on lom. A dict mapping vmin, vmax->locs propertynumticks set_params(numticks=None, presets=None)[source] Set parameters within this locator. tick_values(vmin, vmax)[source] Return the values of the located ticks given vmin and vmax. Note To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance: >>> print(type(loc)) <type 'Locator'> >>> print(loc()) [1, 2, 3, 4] view_limits(vmin, vmax)[source] Try to choose the view limits intelligently.
matplotlib.ticker_api#matplotlib.ticker.LinearLocator
set_params(numticks=None, presets=None)[source] Set parameters within this locator.
matplotlib.ticker_api#matplotlib.ticker.LinearLocator.set_params
tick_values(vmin, vmax)[source] Return the values of the located ticks given vmin and vmax. Note To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance: >>> print(type(loc)) <type 'Locator'> >>> print(loc()) [1, 2, 3, 4]
matplotlib.ticker_api#matplotlib.ticker.LinearLocator.tick_values
view_limits(vmin, vmax)[source] Try to choose the view limits intelligently.
matplotlib.ticker_api#matplotlib.ticker.LinearLocator.view_limits
classmatplotlib.ticker.Locator[source] Bases: matplotlib.ticker.TickHelper Determine the tick locations; Note that the same locator should not be used across multiple Axis because the locator stores references to the Axis data and view limits. MAXTICKS=1000 nonsingular(v0, v1)[source] Adjust a range as needed to avoid singularities. This method gets called during autoscaling, with (v0, v1) set to the data limits on the axes if the axes contains any data, or (-inf, +inf) if not. If v0 == v1 (possibly up to some floating point slop), this method returns an expanded interval around this value. If (v0, v1) == (-inf, +inf), this method returns appropriate default view limits. Otherwise, (v0, v1) is returned without modification. raise_if_exceeds(locs)[source] Log at WARNING level if locs is longer than Locator.MAXTICKS. This is intended to be called immediately before returning locs from __call__ to inform users in case their Locator returns a huge number of ticks, causing Matplotlib to run out of memory. The "strange" name of this method dates back to when it would raise an exception instead of emitting a log. set_params(**kwargs)[source] Do nothing, and raise a warning. Any locator class not supporting the set_params() function will call this. tick_values(vmin, vmax)[source] Return the values of the located ticks given vmin and vmax. Note To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance: >>> print(type(loc)) <type 'Locator'> >>> print(loc()) [1, 2, 3, 4] view_limits(vmin, vmax)[source] Select a scale for the range from vmin to vmax. Subclasses should override this method to change locator behaviour.
matplotlib.ticker_api#matplotlib.ticker.Locator
MAXTICKS=1000
matplotlib.ticker_api#matplotlib.ticker.Locator.MAXTICKS
nonsingular(v0, v1)[source] Adjust a range as needed to avoid singularities. This method gets called during autoscaling, with (v0, v1) set to the data limits on the axes if the axes contains any data, or (-inf, +inf) if not. If v0 == v1 (possibly up to some floating point slop), this method returns an expanded interval around this value. If (v0, v1) == (-inf, +inf), this method returns appropriate default view limits. Otherwise, (v0, v1) is returned without modification.
matplotlib.ticker_api#matplotlib.ticker.Locator.nonsingular
raise_if_exceeds(locs)[source] Log at WARNING level if locs is longer than Locator.MAXTICKS. This is intended to be called immediately before returning locs from __call__ to inform users in case their Locator returns a huge number of ticks, causing Matplotlib to run out of memory. The "strange" name of this method dates back to when it would raise an exception instead of emitting a log.
matplotlib.ticker_api#matplotlib.ticker.Locator.raise_if_exceeds
set_params(**kwargs)[source] Do nothing, and raise a warning. Any locator class not supporting the set_params() function will call this.
matplotlib.ticker_api#matplotlib.ticker.Locator.set_params
tick_values(vmin, vmax)[source] Return the values of the located ticks given vmin and vmax. Note To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance: >>> print(type(loc)) <type 'Locator'> >>> print(loc()) [1, 2, 3, 4]
matplotlib.ticker_api#matplotlib.ticker.Locator.tick_values
view_limits(vmin, vmax)[source] Select a scale for the range from vmin to vmax. Subclasses should override this method to change locator behaviour.
matplotlib.ticker_api#matplotlib.ticker.Locator.view_limits
classmatplotlib.ticker.LogFormatter(base=10.0, labelOnlyBase=False, minor_thresholds=None, linthresh=None)[source] Bases: matplotlib.ticker.Formatter Base class for formatting ticks on a log or symlog scale. It may be instantiated directly, or subclassed. Parameters basefloat, default: 10. Base of the logarithm used in all calculations. labelOnlyBasebool, default: False If True, label ticks only at integer powers of base. This is normally True for major ticks and False for minor ticks. minor_thresholds(subset, all), default: (1, 0.4) If labelOnlyBase is False, these two numbers control the labeling of ticks that are not at integer powers of base; normally these are the minor ticks. The controlling parameter is the log of the axis data range. In the typical case where base is 10 it is the number of decades spanned by the axis, so we can call it 'numdec'. If numdec <= all, all minor ticks will be labeled. If all < numdec <= subset, then only a subset of minor ticks will be labeled, so as to avoid crowding. If numdec > subset then no minor ticks will be labeled. linthreshNone or float, default: None If a symmetric log scale is in use, its linthresh parameter must be supplied here. Notes The set_locs method must be called to enable the subsetting logic controlled by the minor_thresholds parameter. In some cases such as the colorbar, there is no distinction between major and minor ticks; the tick locations might be set manually, or by a locator that puts ticks at integer powers of base and at intermediate locations. For this situation, disable the minor_thresholds logic by using minor_thresholds=(np.inf, np.inf), so that all ticks will be labeled. To disable labeling of minor ticks when 'labelOnlyBase' is False, use minor_thresholds=(0, 0). This is the default for the "classic" style. Examples To label a subset of minor ticks when the view limits span up to 2 decades, and all of the ticks when zoomed in to 0.5 decades or less, use minor_thresholds=(2, 0.5). To label all minor ticks when the view limits span up to 1.5 decades, use minor_thresholds=(1.5, 1.5). base(base)[source] Change the base for labeling. Warning Should always match the base used for LogLocator format_data(value)[source] Return the full string representation of the value with the position unspecified. format_data_short(value)[source] Return a short string version of the tick value. Defaults to the position-independent long value. label_minor(labelOnlyBase)[source] Switch minor tick labeling on or off. Parameters labelOnlyBasebool If True, label ticks only at integer powers of base. set_locs(locs=None)[source] Use axis view limits to control which ticks are labeled. The locs parameter is ignored in the present algorithm.
matplotlib.ticker_api#matplotlib.ticker.LogFormatter
base(base)[source] Change the base for labeling. Warning Should always match the base used for LogLocator
matplotlib.ticker_api#matplotlib.ticker.LogFormatter.base
format_data(value)[source] Return the full string representation of the value with the position unspecified.
matplotlib.ticker_api#matplotlib.ticker.LogFormatter.format_data
format_data_short(value)[source] Return a short string version of the tick value. Defaults to the position-independent long value.
matplotlib.ticker_api#matplotlib.ticker.LogFormatter.format_data_short
label_minor(labelOnlyBase)[source] Switch minor tick labeling on or off. Parameters labelOnlyBasebool If True, label ticks only at integer powers of base.
matplotlib.ticker_api#matplotlib.ticker.LogFormatter.label_minor
set_locs(locs=None)[source] Use axis view limits to control which ticks are labeled. The locs parameter is ignored in the present algorithm.
matplotlib.ticker_api#matplotlib.ticker.LogFormatter.set_locs
classmatplotlib.ticker.LogFormatterExponent(base=10.0, labelOnlyBase=False, minor_thresholds=None, linthresh=None)[source] Bases: matplotlib.ticker.LogFormatter Format values for log axis using exponent = log_base(value).
matplotlib.ticker_api#matplotlib.ticker.LogFormatterExponent
classmatplotlib.ticker.LogFormatterMathtext(base=10.0, labelOnlyBase=False, minor_thresholds=None, linthresh=None)[source] Bases: matplotlib.ticker.LogFormatter Format values for log axis using exponent = log_base(value).
matplotlib.ticker_api#matplotlib.ticker.LogFormatterMathtext
classmatplotlib.ticker.LogFormatterSciNotation(base=10.0, labelOnlyBase=False, minor_thresholds=None, linthresh=None)[source] Bases: matplotlib.ticker.LogFormatterMathtext Format values following scientific notation in a logarithmic axis.
matplotlib.ticker_api#matplotlib.ticker.LogFormatterSciNotation
classmatplotlib.ticker.LogitFormatter(*, use_overline=False, one_half='\x0crac{1}{2}', minor=False, minor_threshold=25, minor_number=6)[source] Bases: matplotlib.ticker.Formatter Probability formatter (using Math text). Parameters use_overlinebool, default: False If x > 1/2, with x = 1-v, indicate if x should be displayed as $overline{v}$. The default is to display $1-v$. one_halfstr, default: r"frac{1}{2}" The string used to represent 1/2. minorbool, default: False Indicate if the formatter is formatting minor ticks or not. Basically minor ticks are not labelled, except when only few ticks are provided, ticks with most space with neighbor ticks are labelled. See other parameters to change the default behavior. minor_thresholdint, default: 25 Maximum number of locs for labelling some minor ticks. This parameter have no effect if minor is False. minor_numberint, default: 6 Number of ticks which are labelled when the number of ticks is below the threshold. format_data_short(value)[source] Return a short string version of the tick value. Defaults to the position-independent long value. set_locs(locs)[source] Set the locations of the ticks. This method is called before computing the tick labels because some formatters need to know all tick locations to do so. set_minor_number(minor_number)[source] Set the number of minor ticks to label when some minor ticks are labelled. Parameters minor_numberint Number of ticks which are labelled when the number of ticks is below the threshold. set_minor_threshold(minor_threshold)[source] Set the threshold for labelling minors ticks. Parameters minor_thresholdint Maximum number of locations for labelling some minor ticks. This parameter have no effect if minor is False. set_one_half(one_half)[source] Set the way one half is displayed. one_halfstr, default: r"frac{1}{2}" The string used to represent 1/2. use_overline(use_overline)[source] Switch display mode with overline for labelling p>1/2. Parameters use_overlinebool, default: False If x > 1/2, with x = 1-v, indicate if x should be displayed as $overline{v}$. The default is to display $1-v$.
matplotlib.ticker_api#matplotlib.ticker.LogitFormatter
format_data_short(value)[source] Return a short string version of the tick value. Defaults to the position-independent long value.
matplotlib.ticker_api#matplotlib.ticker.LogitFormatter.format_data_short
set_locs(locs)[source] Set the locations of the ticks. This method is called before computing the tick labels because some formatters need to know all tick locations to do so.
matplotlib.ticker_api#matplotlib.ticker.LogitFormatter.set_locs
set_minor_number(minor_number)[source] Set the number of minor ticks to label when some minor ticks are labelled. Parameters minor_numberint Number of ticks which are labelled when the number of ticks is below the threshold.
matplotlib.ticker_api#matplotlib.ticker.LogitFormatter.set_minor_number
set_minor_threshold(minor_threshold)[source] Set the threshold for labelling minors ticks. Parameters minor_thresholdint Maximum number of locations for labelling some minor ticks. This parameter have no effect if minor is False.
matplotlib.ticker_api#matplotlib.ticker.LogitFormatter.set_minor_threshold
set_one_half(one_half)[source] Set the way one half is displayed. one_halfstr, default: r"frac{1}{2}" The string used to represent 1/2.
matplotlib.ticker_api#matplotlib.ticker.LogitFormatter.set_one_half
use_overline(use_overline)[source] Switch display mode with overline for labelling p>1/2. Parameters use_overlinebool, default: False If x > 1/2, with x = 1-v, indicate if x should be displayed as $overline{v}$. The default is to display $1-v$.
matplotlib.ticker_api#matplotlib.ticker.LogitFormatter.use_overline
classmatplotlib.ticker.LogitLocator(minor=False, *, nbins='auto')[source] Bases: matplotlib.ticker.MaxNLocator Determine the tick locations for logit axes Place ticks on the logit locations Parameters nbinsint or 'auto', optional Number of ticks. Only used if minor is False. minorbool, default: False Indicate if this locator is for minor ticks or not. propertyminor nonsingular(vmin, vmax)[source] Adjust a range as needed to avoid singularities. This method gets called during autoscaling, with (v0, v1) set to the data limits on the axes if the axes contains any data, or (-inf, +inf) if not. If v0 == v1 (possibly up to some floating point slop), this method returns an expanded interval around this value. If (v0, v1) == (-inf, +inf), this method returns appropriate default view limits. Otherwise, (v0, v1) is returned without modification. set_params(minor=None, **kwargs)[source] Set parameters within this locator. tick_values(vmin, vmax)[source] Return the values of the located ticks given vmin and vmax. Note To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance: >>> print(type(loc)) <type 'Locator'> >>> print(loc()) [1, 2, 3, 4]
matplotlib.ticker_api#matplotlib.ticker.LogitLocator
nonsingular(vmin, vmax)[source] Adjust a range as needed to avoid singularities. This method gets called during autoscaling, with (v0, v1) set to the data limits on the axes if the axes contains any data, or (-inf, +inf) if not. If v0 == v1 (possibly up to some floating point slop), this method returns an expanded interval around this value. If (v0, v1) == (-inf, +inf), this method returns appropriate default view limits. Otherwise, (v0, v1) is returned without modification.
matplotlib.ticker_api#matplotlib.ticker.LogitLocator.nonsingular
set_params(minor=None, **kwargs)[source] Set parameters within this locator.
matplotlib.ticker_api#matplotlib.ticker.LogitLocator.set_params
tick_values(vmin, vmax)[source] Return the values of the located ticks given vmin and vmax. Note To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance: >>> print(type(loc)) <type 'Locator'> >>> print(loc()) [1, 2, 3, 4]
matplotlib.ticker_api#matplotlib.ticker.LogitLocator.tick_values
classmatplotlib.ticker.LogLocator(base=10.0, subs=(1.0,), numdecs=4, numticks=None)[source] Bases: matplotlib.ticker.Locator Determine the tick locations for log axes Place ticks on the locations : subs[j] * base**i Parameters basefloat, default: 10.0 The base of the log used, so ticks are placed at base**n. subsNone or str or sequence of float, default: (1.0,) Gives the multiples of integer powers of the base at which to place ticks. The default places ticks only at integer powers of the base. The permitted string values are 'auto' and 'all', both of which use an algorithm based on the axis view limits to determine whether and how to put ticks between integer powers of the base. With 'auto', ticks are placed only between integer powers; with 'all', the integer powers are included. A value of None is equivalent to 'auto'. numticksNone or int, default: None The maximum number of ticks to allow on a given axis. The default of None will try to choose intelligently as long as this Locator has already been assigned to an axis using get_tick_space, but otherwise falls back to 9. base(base)[source] Set the log base (major tick every base**i, i integer). nonsingular(vmin, vmax)[source] Adjust a range as needed to avoid singularities. This method gets called during autoscaling, with (v0, v1) set to the data limits on the axes if the axes contains any data, or (-inf, +inf) if not. If v0 == v1 (possibly up to some floating point slop), this method returns an expanded interval around this value. If (v0, v1) == (-inf, +inf), this method returns appropriate default view limits. Otherwise, (v0, v1) is returned without modification. set_params(base=None, subs=None, numdecs=None, numticks=None)[source] Set parameters within this locator. subs(subs)[source] Set the minor ticks for the log scaling every base**i*subs[j]. tick_values(vmin, vmax)[source] Return the values of the located ticks given vmin and vmax. Note To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance: >>> print(type(loc)) <type 'Locator'> >>> print(loc()) [1, 2, 3, 4] view_limits(vmin, vmax)[source] Try to choose the view limits intelligently.
matplotlib.ticker_api#matplotlib.ticker.LogLocator
base(base)[source] Set the log base (major tick every base**i, i integer).
matplotlib.ticker_api#matplotlib.ticker.LogLocator.base
nonsingular(vmin, vmax)[source] Adjust a range as needed to avoid singularities. This method gets called during autoscaling, with (v0, v1) set to the data limits on the axes if the axes contains any data, or (-inf, +inf) if not. If v0 == v1 (possibly up to some floating point slop), this method returns an expanded interval around this value. If (v0, v1) == (-inf, +inf), this method returns appropriate default view limits. Otherwise, (v0, v1) is returned without modification.
matplotlib.ticker_api#matplotlib.ticker.LogLocator.nonsingular
set_params(base=None, subs=None, numdecs=None, numticks=None)[source] Set parameters within this locator.
matplotlib.ticker_api#matplotlib.ticker.LogLocator.set_params
subs(subs)[source] Set the minor ticks for the log scaling every base**i*subs[j].
matplotlib.ticker_api#matplotlib.ticker.LogLocator.subs
tick_values(vmin, vmax)[source] Return the values of the located ticks given vmin and vmax. Note To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance: >>> print(type(loc)) <type 'Locator'> >>> print(loc()) [1, 2, 3, 4]
matplotlib.ticker_api#matplotlib.ticker.LogLocator.tick_values
view_limits(vmin, vmax)[source] Try to choose the view limits intelligently.
matplotlib.ticker_api#matplotlib.ticker.LogLocator.view_limits
classmatplotlib.ticker.MaxNLocator(nbins=None, **kwargs)[source] Bases: matplotlib.ticker.Locator Find nice tick locations with no more than N being within the view limits. Locations beyond the limits are added to support autoscaling. Parameters nbinsint or 'auto', default: 10 Maximum number of intervals; one less than max number of ticks. If the string 'auto', the number of bins will be automatically determined based on the length of the axis. stepsarray-like, optional Sequence of nice numbers starting with 1 and ending with 10; e.g., [1, 2, 4, 5, 10], where the values are acceptable tick multiples. i.e. for the example, 20, 40, 60 would be an acceptable set of ticks, as would 0.4, 0.6, 0.8, because they are multiples of 2. However, 30, 60, 90 would not be allowed because 3 does not appear in the list of steps. integerbool, default: False If True, ticks will take only integer values, provided at least min_n_ticks integers are found within the view limits. symmetricbool, default: False If True, autoscaling will result in a range symmetric about zero. prune{'lower', 'upper', 'both', None}, default: None Remove edge ticks -- useful for stacked or ganged plots where the upper tick of one axes overlaps with the lower tick of the axes above it, primarily when rcParams["axes.autolimit_mode"] (default: 'data') is 'round_numbers'. If prune=='lower', the smallest tick will be removed. If prune == 'upper', the largest tick will be removed. If prune == 'both', the largest and smallest ticks will be removed. If prune is None, no ticks will be removed. min_n_ticksint, default: 2 Relax nbins and integer constraints if necessary to obtain this minimum number of ticks. default_params={'integer': False, 'min_n_ticks': 2, 'nbins': 10, 'prune': None, 'steps': None, 'symmetric': False} set_params(**kwargs)[source] Set parameters for this locator. Parameters nbinsint or 'auto', optional see MaxNLocator stepsarray-like, optional see MaxNLocator integerbool, optional see MaxNLocator symmetricbool, optional see MaxNLocator prune{'lower', 'upper', 'both', None}, optional see MaxNLocator min_n_ticksint, optional see MaxNLocator tick_values(vmin, vmax)[source] Return the values of the located ticks given vmin and vmax. Note To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance: >>> print(type(loc)) <type 'Locator'> >>> print(loc()) [1, 2, 3, 4] view_limits(dmin, dmax)[source] Select a scale for the range from vmin to vmax. Subclasses should override this method to change locator behaviour.
matplotlib.ticker_api#matplotlib.ticker.MaxNLocator
default_params={'integer': False, 'min_n_ticks': 2, 'nbins': 10, 'prune': None, 'steps': None, 'symmetric': False}
matplotlib.ticker_api#matplotlib.ticker.MaxNLocator.default_params
set_params(**kwargs)[source] Set parameters for this locator. Parameters nbinsint or 'auto', optional see MaxNLocator stepsarray-like, optional see MaxNLocator integerbool, optional see MaxNLocator symmetricbool, optional see MaxNLocator prune{'lower', 'upper', 'both', None}, optional see MaxNLocator min_n_ticksint, optional see MaxNLocator
matplotlib.ticker_api#matplotlib.ticker.MaxNLocator.set_params
tick_values(vmin, vmax)[source] Return the values of the located ticks given vmin and vmax. Note To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance: >>> print(type(loc)) <type 'Locator'> >>> print(loc()) [1, 2, 3, 4]
matplotlib.ticker_api#matplotlib.ticker.MaxNLocator.tick_values
view_limits(dmin, dmax)[source] Select a scale for the range from vmin to vmax. Subclasses should override this method to change locator behaviour.
matplotlib.ticker_api#matplotlib.ticker.MaxNLocator.view_limits
classmatplotlib.ticker.MultipleLocator(base=1.0)[source] Bases: matplotlib.ticker.Locator Set a tick on each integer multiple of a base within the view interval. set_params(base)[source] Set parameters within this locator. tick_values(vmin, vmax)[source] Return the values of the located ticks given vmin and vmax. Note To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance: >>> print(type(loc)) <type 'Locator'> >>> print(loc()) [1, 2, 3, 4] view_limits(dmin, dmax)[source] Set the view limits to the nearest multiples of base that contain the data.
matplotlib.ticker_api#matplotlib.ticker.MultipleLocator
set_params(base)[source] Set parameters within this locator.
matplotlib.ticker_api#matplotlib.ticker.MultipleLocator.set_params
tick_values(vmin, vmax)[source] Return the values of the located ticks given vmin and vmax. Note To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance: >>> print(type(loc)) <type 'Locator'> >>> print(loc()) [1, 2, 3, 4]
matplotlib.ticker_api#matplotlib.ticker.MultipleLocator.tick_values
view_limits(dmin, dmax)[source] Set the view limits to the nearest multiples of base that contain the data.
matplotlib.ticker_api#matplotlib.ticker.MultipleLocator.view_limits
classmatplotlib.ticker.NullFormatter[source] Bases: matplotlib.ticker.Formatter Always return the empty string.
matplotlib.ticker_api#matplotlib.ticker.NullFormatter
classmatplotlib.ticker.NullLocator[source] Bases: matplotlib.ticker.Locator No ticks tick_values(vmin, vmax)[source] Return the locations of the ticks. Note Because the values are Null, vmin and vmax are not used in this method.
matplotlib.ticker_api#matplotlib.ticker.NullLocator
tick_values(vmin, vmax)[source] Return the locations of the ticks. Note Because the values are Null, vmin and vmax are not used in this method.
matplotlib.ticker_api#matplotlib.ticker.NullLocator.tick_values
classmatplotlib.ticker.PercentFormatter(xmax=100, decimals=None, symbol='%', is_latex=False)[source] Bases: matplotlib.ticker.Formatter Format numbers as a percentage. Parameters xmaxfloat Determines how the number is converted into a percentage. xmax is the data value that corresponds to 100%. Percentages are computed as x / xmax * 100. So if the data is already scaled to be percentages, xmax will be 100. Another common situation is where xmax is 1.0. decimalsNone or int The number of decimal places to place after the point. If None (the default), the number will be computed automatically. symbolstr or None A string that will be appended to the label. It may be None or empty to indicate that no symbol should be used. LaTeX special characters are escaped in symbol whenever latex mode is enabled, unless is_latex is True. is_latexbool If False, reserved LaTeX characters in symbol will be escaped. convert_to_pct(x)[source] format_pct(x, display_range)[source] Format the number as a percentage number with the correct number of decimals and adds the percent symbol, if any. If self.decimals is None, the number of digits after the decimal point is set based on the display_range of the axis as follows: display_range decimals sample >50 0 x = 34.5 => 35% >5 1 x = 34.5 => 34.5% >0.5 2 x = 34.5 => 34.50% ... ... ... This method will not be very good for tiny axis ranges or extremely large ones. It assumes that the values on the chart are percentages displayed on a reasonable scale. propertysymbol The configured percent symbol as a string. If LaTeX is enabled via rcParams["text.usetex"] (default: False), the special characters {'#', '$', '%', '&', '~', '_', '^', '\', '{', '}'} are automatically escaped in the string.
matplotlib.ticker_api#matplotlib.ticker.PercentFormatter
convert_to_pct(x)[source]
matplotlib.ticker_api#matplotlib.ticker.PercentFormatter.convert_to_pct
format_pct(x, display_range)[source] Format the number as a percentage number with the correct number of decimals and adds the percent symbol, if any. If self.decimals is None, the number of digits after the decimal point is set based on the display_range of the axis as follows: display_range decimals sample >50 0 x = 34.5 => 35% >5 1 x = 34.5 => 34.5% >0.5 2 x = 34.5 => 34.50% ... ... ... This method will not be very good for tiny axis ranges or extremely large ones. It assumes that the values on the chart are percentages displayed on a reasonable scale.
matplotlib.ticker_api#matplotlib.ticker.PercentFormatter.format_pct
classmatplotlib.ticker.ScalarFormatter(useOffset=None, useMathText=None, useLocale=None)[source] Bases: matplotlib.ticker.Formatter Format tick values as a number. Parameters useOffsetbool or float, default: rcParams["axes.formatter.useoffset"] (default: True) Whether to use offset notation. See set_useOffset. useMathTextbool, default: rcParams["axes.formatter.use_mathtext"] (default: False) Whether to use fancy math formatting. See set_useMathText. useLocalebool, default: rcParams["axes.formatter.use_locale"] (default: False). Whether to use locale settings for decimal sign and positive sign. See set_useLocale. Notes In addition to the parameters above, the formatting of scientific vs. floating point representation can be configured via set_scientific and set_powerlimits). Offset notation and scientific notation Offset notation and scientific notation look quite similar at first sight. Both split some information from the formatted tick values and display it at the end of the axis. The scientific notation splits up the order of magnitude, i.e. a multiplicative scaling factor, e.g. 1e6. The offset notation separates an additive constant, e.g. +1e6. The offset notation label is always prefixed with a + or - sign and is thus distinguishable from the order of magnitude label. The following plot with x limits 1_000_000 to 1_000_010 illustrates the different formatting. Note the labels at the right edge of the x axis. (Source code, png, pdf) format_data(value)[source] Return the full string representation of the value with the position unspecified. format_data_short(value)[source] Return a short string version of the tick value. Defaults to the position-independent long value. get_offset()[source] Return scientific notation, plus offset. get_useLocale()[source] Return whether locale settings are used for formatting. See also ScalarFormatter.set_useLocale get_useMathText()[source] Return whether to use fancy math formatting. See also ScalarFormatter.set_useMathText get_useOffset()[source] Return whether automatic mode for offset notation is active. This returns True if set_useOffset(True); it returns False if an explicit offset was set, e.g. set_useOffset(1000). See also ScalarFormatter.set_useOffset set_locs(locs)[source] Set the locations of the ticks. This method is called before computing the tick labels because some formatters need to know all tick locations to do so. set_powerlimits(lims)[source] Set size thresholds for scientific notation. Parameters lims(int, int) A tuple (min_exp, max_exp) containing the powers of 10 that determine the switchover threshold. For a number representable as \(a \times 10^\mathrm{exp}\) with \(1 <= |a| < 10\), scientific notation will be used if exp <= min_exp or exp >= max_exp. The default limits are controlled by rcParams["axes.formatter.limits"] (default: [-5, 6]). In particular numbers with exp equal to the thresholds are written in scientific notation. Typically, min_exp will be negative and max_exp will be positive. For example, formatter.set_powerlimits((-3, 4)) will provide the following formatting: \(1 \times 10^{-3}, 9.9 \times 10^{-3}, 0.01,\) \(9999, 1 \times 10^4\). See also ScalarFormatter.set_scientific set_scientific(b)[source] Turn scientific notation on or off. See also ScalarFormatter.set_powerlimits set_useLocale(val)[source] Set whether to use locale settings for decimal sign and positive sign. Parameters valbool or None None resets to rcParams["axes.formatter.use_locale"] (default: False). set_useMathText(val)[source] Set whether to use fancy math formatting. If active, scientific notation is formatted as \(1.2 \times 10^3\). Parameters valbool or None None resets to rcParams["axes.formatter.use_mathtext"] (default: False). set_useOffset(val)[source] Set whether to use offset notation. When formatting a set numbers whose value is large compared to their range, the formatter can separate an additive constant. This can shorten the formatted numbers so that they are less likely to overlap when drawn on an axis. Parameters valbool or float If False, do not use offset notation. If True (=automatic mode), use offset notation if it can make the residual numbers significantly shorter. The exact behavior is controlled by rcParams["axes.formatter.offset_threshold"] (default: 4). If a number, force an offset of the given value. Examples With active offset notation, the values 100_000, 100_002, 100_004, 100_006, 100_008 will be formatted as 0, 2, 4, 6, 8 plus an offset +1e5, which is written to the edge of the axis. propertyuseLocale Return whether locale settings are used for formatting. See also ScalarFormatter.set_useLocale propertyuseMathText Return whether to use fancy math formatting. See also ScalarFormatter.set_useMathText propertyuseOffset Return whether automatic mode for offset notation is active. This returns True if set_useOffset(True); it returns False if an explicit offset was set, e.g. set_useOffset(1000). See also ScalarFormatter.set_useOffset
matplotlib.ticker_api#matplotlib.ticker.ScalarFormatter
format_data(value)[source] Return the full string representation of the value with the position unspecified.
matplotlib.ticker_api#matplotlib.ticker.ScalarFormatter.format_data
format_data_short(value)[source] Return a short string version of the tick value. Defaults to the position-independent long value.
matplotlib.ticker_api#matplotlib.ticker.ScalarFormatter.format_data_short
get_offset()[source] Return scientific notation, plus offset.
matplotlib.ticker_api#matplotlib.ticker.ScalarFormatter.get_offset
get_useLocale()[source] Return whether locale settings are used for formatting. See also ScalarFormatter.set_useLocale
matplotlib.ticker_api#matplotlib.ticker.ScalarFormatter.get_useLocale
get_useMathText()[source] Return whether to use fancy math formatting. See also ScalarFormatter.set_useMathText
matplotlib.ticker_api#matplotlib.ticker.ScalarFormatter.get_useMathText
get_useOffset()[source] Return whether automatic mode for offset notation is active. This returns True if set_useOffset(True); it returns False if an explicit offset was set, e.g. set_useOffset(1000). See also ScalarFormatter.set_useOffset
matplotlib.ticker_api#matplotlib.ticker.ScalarFormatter.get_useOffset
set_locs(locs)[source] Set the locations of the ticks. This method is called before computing the tick labels because some formatters need to know all tick locations to do so.
matplotlib.ticker_api#matplotlib.ticker.ScalarFormatter.set_locs
set_powerlimits(lims)[source] Set size thresholds for scientific notation. Parameters lims(int, int) A tuple (min_exp, max_exp) containing the powers of 10 that determine the switchover threshold. For a number representable as \(a \times 10^\mathrm{exp}\) with \(1 <= |a| < 10\), scientific notation will be used if exp <= min_exp or exp >= max_exp. The default limits are controlled by rcParams["axes.formatter.limits"] (default: [-5, 6]). In particular numbers with exp equal to the thresholds are written in scientific notation. Typically, min_exp will be negative and max_exp will be positive. For example, formatter.set_powerlimits((-3, 4)) will provide the following formatting: \(1 \times 10^{-3}, 9.9 \times 10^{-3}, 0.01,\) \(9999, 1 \times 10^4\). See also ScalarFormatter.set_scientific
matplotlib.ticker_api#matplotlib.ticker.ScalarFormatter.set_powerlimits
set_scientific(b)[source] Turn scientific notation on or off. See also ScalarFormatter.set_powerlimits
matplotlib.ticker_api#matplotlib.ticker.ScalarFormatter.set_scientific
set_useLocale(val)[source] Set whether to use locale settings for decimal sign and positive sign. Parameters valbool or None None resets to rcParams["axes.formatter.use_locale"] (default: False).
matplotlib.ticker_api#matplotlib.ticker.ScalarFormatter.set_useLocale
set_useMathText(val)[source] Set whether to use fancy math formatting. If active, scientific notation is formatted as \(1.2 \times 10^3\). Parameters valbool or None None resets to rcParams["axes.formatter.use_mathtext"] (default: False).
matplotlib.ticker_api#matplotlib.ticker.ScalarFormatter.set_useMathText
set_useOffset(val)[source] Set whether to use offset notation. When formatting a set numbers whose value is large compared to their range, the formatter can separate an additive constant. This can shorten the formatted numbers so that they are less likely to overlap when drawn on an axis. Parameters valbool or float If False, do not use offset notation. If True (=automatic mode), use offset notation if it can make the residual numbers significantly shorter. The exact behavior is controlled by rcParams["axes.formatter.offset_threshold"] (default: 4). If a number, force an offset of the given value. Examples With active offset notation, the values 100_000, 100_002, 100_004, 100_006, 100_008 will be formatted as 0, 2, 4, 6, 8 plus an offset +1e5, which is written to the edge of the axis.
matplotlib.ticker_api#matplotlib.ticker.ScalarFormatter.set_useOffset
classmatplotlib.ticker.StrMethodFormatter(fmt)[source] Bases: matplotlib.ticker.Formatter Use a new-style format string (as used by str.format) to format the tick. The field used for the tick value must be labeled x and the field used for the tick position must be labeled pos.
matplotlib.ticker_api#matplotlib.ticker.StrMethodFormatter
classmatplotlib.ticker.SymmetricalLogLocator(transform=None, subs=None, linthresh=None, base=None)[source] Bases: matplotlib.ticker.Locator Determine the tick locations for symmetric log axes. Parameters transformSymmetricalLogTransform, optional If set, defines the base and linthresh of the symlog transform. base, linthreshfloat, optional The base and linthresh of the symlog transform, as documented for SymmetricalLogScale. These parameters are only used if transform is not set. subssequence of float, default: [1] The multiples of integer powers of the base where ticks are placed, i.e., ticks are placed at [sub * base**i for i in ... for sub in subs]. Notes Either transform, or both base and linthresh, must be given. set_params(subs=None, numticks=None)[source] Set parameters within this locator. tick_values(vmin, vmax)[source] Return the values of the located ticks given vmin and vmax. Note To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance: >>> print(type(loc)) <type 'Locator'> >>> print(loc()) [1, 2, 3, 4] view_limits(vmin, vmax)[source] Try to choose the view limits intelligently.
matplotlib.ticker_api#matplotlib.ticker.SymmetricalLogLocator
set_params(subs=None, numticks=None)[source] Set parameters within this locator.
matplotlib.ticker_api#matplotlib.ticker.SymmetricalLogLocator.set_params
tick_values(vmin, vmax)[source] Return the values of the located ticks given vmin and vmax. Note To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance: >>> print(type(loc)) <type 'Locator'> >>> print(loc()) [1, 2, 3, 4]
matplotlib.ticker_api#matplotlib.ticker.SymmetricalLogLocator.tick_values
view_limits(vmin, vmax)[source] Try to choose the view limits intelligently.
matplotlib.ticker_api#matplotlib.ticker.SymmetricalLogLocator.view_limits
classmatplotlib.ticker.TickHelper[source] Bases: object axis=None create_dummy_axis(**kwargs)[source] set_axis(axis)[source] set_bounds(vmin, vmax)[source] [Deprecated] Notes Deprecated since version 3.5: set_data_interval(vmin, vmax)[source] [Deprecated] Notes Deprecated since version 3.5: set_view_interval(vmin, vmax)[source] [Deprecated] Notes Deprecated since version 3.5:
matplotlib.ticker_api#matplotlib.ticker.TickHelper
axis=None
matplotlib.ticker_api#matplotlib.ticker.TickHelper.axis
create_dummy_axis(**kwargs)[source]
matplotlib.ticker_api#matplotlib.ticker.TickHelper.create_dummy_axis
set_axis(axis)[source]
matplotlib.ticker_api#matplotlib.ticker.TickHelper.set_axis
set_bounds(vmin, vmax)[source] [Deprecated] Notes Deprecated since version 3.5:
matplotlib.ticker_api#matplotlib.ticker.TickHelper.set_bounds
set_data_interval(vmin, vmax)[source] [Deprecated] Notes Deprecated since version 3.5:
matplotlib.ticker_api#matplotlib.ticker.TickHelper.set_data_interval
set_view_interval(vmin, vmax)[source] [Deprecated] Notes Deprecated since version 3.5:
matplotlib.ticker_api#matplotlib.ticker.TickHelper.set_view_interval
matplotlib.tight_bbox Helper module for the bbox_inches parameter in Figure.savefig. matplotlib.tight_bbox.adjust_bbox(fig, bbox_inches, fixed_dpi=None)[source] Temporarily adjust the figure so that only the specified area (bbox_inches) is saved. It modifies fig.bbox, fig.bbox_inches, fig.transFigure._boxout, and fig.patch. While the figure size changes, the scale of the original figure is conserved. A function which restores the original values are returned. matplotlib.tight_bbox.process_figure_for_rasterizing(fig, bbox_inches_restore, fixed_dpi=None)[source] A function that needs to be called when figure dpi changes during the drawing (e.g., rasterizing). It recovers the bbox and re-adjust it with the new dpi.
matplotlib.tight_bbox_api
matplotlib.tight_bbox.adjust_bbox(fig, bbox_inches, fixed_dpi=None)[source] Temporarily adjust the figure so that only the specified area (bbox_inches) is saved. It modifies fig.bbox, fig.bbox_inches, fig.transFigure._boxout, and fig.patch. While the figure size changes, the scale of the original figure is conserved. A function which restores the original values are returned.
matplotlib.tight_bbox_api#matplotlib.tight_bbox.adjust_bbox
matplotlib.tight_bbox.process_figure_for_rasterizing(fig, bbox_inches_restore, fixed_dpi=None)[source] A function that needs to be called when figure dpi changes during the drawing (e.g., rasterizing). It recovers the bbox and re-adjust it with the new dpi.
matplotlib.tight_bbox_api#matplotlib.tight_bbox.process_figure_for_rasterizing
matplotlib.tight_layout Routines to adjust subplot params so that subplots are nicely fit in the figure. In doing so, only axis labels, tick labels, axes titles and offsetboxes that are anchored to axes are currently considered. Internally, this module assumes that the margins (left margin, etc.) which are differences between Axes.get_tightbbox and Axes.bbox are independent of Axes position. This may fail if Axes.adjustable is datalim as well as such cases as when left or right margin are affected by xlabel. matplotlib.tight_layout.auto_adjust_subplotpars(fig, renderer, nrows_ncols, num1num2_list, subplot_list, ax_bbox_list=None, pad=1.08, h_pad=None, w_pad=None, rect=None)[source] [Deprecated] Return a dict of subplot parameters to adjust spacing between subplots or None if resulting axes would have zero height or width. Note that this function ignores geometry information of subplot itself, but uses what is given by the nrows_ncols and num1num2_list parameters. Also, the results could be incorrect if some subplots have adjustable=datalim. Parameters nrows_ncolstuple[int, int] Number of rows and number of columns of the grid. num1num2_listlist[tuple[int, int]] List of numbers specifying the area occupied by the subplot subplot_listlist of subplots List of subplots that will be used to calculate optimal subplot_params. padfloat Padding between the figure edge and the edges of subplots, as a fraction of the font size. h_pad, w_padfloat Padding (height/width) between edges of adjacent subplots, as a fraction of the font size. Defaults to pad. recttuple[float, float, float, float] [left, bottom, right, top] in normalized (0, 1) figure coordinates. Notes Deprecated since version 3.5. matplotlib.tight_layout.get_renderer(fig)[source] matplotlib.tight_layout.get_subplotspec_list(axes_list, grid_spec=None)[source] Return a list of subplotspec from the given list of axes. For an instance of axes that does not support subplotspec, None is inserted in the list. If grid_spec is given, None is inserted for those not from the given grid_spec. matplotlib.tight_layout.get_tight_layout_figure(fig, axes_list, subplotspec_list, renderer, pad=1.08, h_pad=None, w_pad=None, rect=None)[source] Return subplot parameters for tight-layouted-figure with specified padding. Parameters figFigure axes_listlist of Axes subplotspec_listlist of SubplotSpec The subplotspecs of each axes. rendererrenderer padfloat Padding between the figure edge and the edges of subplots, as a fraction of the font size. h_pad, w_padfloat Padding (height/width) between edges of adjacent subplots. Defaults to pad. recttuple[float, float, float, float], optional (left, bottom, right, top) rectangle in normalized figure coordinates that the whole subplots area (including labels) will fit into. Defaults to using the entire figure. Returns subplotspec or None subplotspec kwargs to be passed to Figure.subplots_adjust or None if tight_layout could not be accomplished.
matplotlib.tight_layout_api
matplotlib.tight_layout.auto_adjust_subplotpars(fig, renderer, nrows_ncols, num1num2_list, subplot_list, ax_bbox_list=None, pad=1.08, h_pad=None, w_pad=None, rect=None)[source] [Deprecated] Return a dict of subplot parameters to adjust spacing between subplots or None if resulting axes would have zero height or width. Note that this function ignores geometry information of subplot itself, but uses what is given by the nrows_ncols and num1num2_list parameters. Also, the results could be incorrect if some subplots have adjustable=datalim. Parameters nrows_ncolstuple[int, int] Number of rows and number of columns of the grid. num1num2_listlist[tuple[int, int]] List of numbers specifying the area occupied by the subplot subplot_listlist of subplots List of subplots that will be used to calculate optimal subplot_params. padfloat Padding between the figure edge and the edges of subplots, as a fraction of the font size. h_pad, w_padfloat Padding (height/width) between edges of adjacent subplots, as a fraction of the font size. Defaults to pad. recttuple[float, float, float, float] [left, bottom, right, top] in normalized (0, 1) figure coordinates. Notes Deprecated since version 3.5.
matplotlib.tight_layout_api#matplotlib.tight_layout.auto_adjust_subplotpars