matplotlib.category
¶Module that allows plotting of string "category" data. i.e.
plot(['d', 'f', 'a'],[1, 2, 3])
will plot three points with x-axis
values of 'd', 'f', 'a'.
See Plotting categorical variables for an example.
The module uses Matplotlib's matplotlib.units
mechanism to convert from
strings to integers, provides a tick locator and formatter, and the
class:UnitData
that creates and stores the string-to-integer mapping.
matplotlib.category.
StrCategoryConverter
[source]¶Bases: matplotlib.units.ConversionInterface
axisinfo
(unit, axis)[source]¶Sets the default axis ticks and labels
UnitData
axis
Returns: | :class:~matplotlib.units.AxisInfo~
|
---|
convert
(value, unit, axis)[source]¶Converts strings in value to floats using mapping information store in the unit object.
Parameters: | value : string or iterable
unit :
axis :
|
---|---|
Returns: | mapped_ value : float or ndarray[float] Note axis is not used in this function |
matplotlib.category.
StrCategoryFormatter
(units_mapping)[source]¶Bases: matplotlib.ticker.Formatter
String representation of the data at every tick
Parameters: | units_mapping : Dict[Str, int]
|
---|
matplotlib.category.
StrCategoryLocator
(units_mapping)[source]¶Bases: matplotlib.ticker.Locator
tick at every integer mapping of the string data
Parameters: | units_mapping : Dict[str, int]
|
---|