Plotting
Style
You can apply your own custom plotting styles in addition to the MindLab default style via the
tool.mindlab.styles
list in pyproject.toml
or by using the
mindlab.use_mindlab_styles()
function.
- mindlab.use_mindlab_styles(style_install_path: Optional[Path] = None, font_install_path: Optional[Path] = None, project_styles: Optional[Union[bool, Iterable[str]]] = None) bool
Install and use MindLab and project styles.
- Parameters
style_install_path – The path to install the MindLab styles to. Defaults to the Matplotlib package style library directory.
font_install_path – The path to install the style fonts to. Defaults to
$XDG_DATA_HOME/fonts
.project_styles – The project styles to use in addition to the MindLab style. Defaults to
tool.mindlab.styles
inpyproject.toml
.
- Returns
Reference
- class mindlab.Figure(size: Optional[Tuple[float, float]] = None, title: Optional[str] = None, xlabel: Optional[str] = None, ylabel: Optional[str] = None, xtics: Optional[str] = None, ytics: Optional[str] = None, xscale: Optional[str] = None, yscale: Optional[str] = None, xlim: Optional[Tuple[Optional[float], Optional[float]]] = None, ylim: Optional[Tuple[Optional[float], Optional[float]]] = None, legend: Optional[str] = 'best')
Create professional plots easily.
Note that in addition to the overwritten methods described below, a Figure instance also exposes all the same methods as the underlying
matplotlib.axes.Axes
instance.- Parameters
size – The size of the figure (in inches).
title – The title of the figure.
xlabel – The x axis label of the figure.
ylabel – The y axis label of the figure.
xtics – The x tick locators (one of
eng
,auto
,log
,percent
,year
,month
,week
orday
). Defaults toeng
inlinear
scale andlog
inlog
scale.ytics – The y tick locators (same choices as for xtics).
xscale – The scale of the x axis (one of
linear
orlog
).yscale – The scale of the y axis (same choices as for xscale).
xlim – The x axis limits.
ylim – The y axis limits.
legend – The location of the legend (either
best
, or a combination oftop
/center
/bottom
andleft
/center
/right
.
- figure
The underlying figure instance.
- axes
The underlying axes instance.
- Type
- save(output: Union[Path, IOBase], **kwargs: Any) None
Save the figure.
- Parameters
output – A path or object to use for saving.
**kwargs – Arguments to forward to
matplotlib.figure.Figure.savefig()
.
- line(*args: Any, **kwargs: Any) None
Draw a line chart.
- Parameters
*args – Arguments to forward to
matplotlib.axes.Axes.plot()
. If the first argument is a grouped data frame (see GroupBy) we draw a line for each group.**kwargs – Arguments to forward to
matplotlib.axes.Axes.plot()
.
- scatter(*args: Any, **kwargs: Any) None
Draw a scatter plot.
- Parameters
*args – Arguments to forward to
matplotlib.axes.Axes.scatter()
. If the first argument is a grouped data frame (see GroupBy) we draw a scatter plot for each group.**kwargs – Arguments to forward to
matplotlib.axes.Axes.scatter()
.
- bar(data: DataFrameGroupBy, **kwargs: Any) None
Draw a stacked bar chart.
- Parameters
data – The grouped data frame to plot (see GroupBy).
**kwargs – Arguments to forward to
matplotlib.axes.Axes.bar()
.