Utils for Matplotlib
func2legend
func2legend (obj:matplotlib.figure.Figure|matplotlib.axes._axes.Axes|list [matplotlib.axes._axes.Axes]|None, func:Callable, *args, **kwargs)
func2lines
func2lines (obj:matplotlib.figure.Figure|matplotlib.axes._axes.Axes|list[ matplotlib.axes._axes.Axes]|None, func:Callable, *args, **kwargs)
func2axes
func2axes (obj:matplotlib.figure.Figure|matplotlib.axes._axes.Axes|list[m atplotlib.axes._axes.Axes]|None, func:Callable, *args, **kwargs)
get_axes
get_axes (obj:matplotlib.figure.Figure|matplotlib.axes._axes.Axes|list[ma tplotlib.axes._axes.Axes]|None)
figsize
figsize (col=1, width:float=None, height:float=None, ratio:float=None)
Return figure size for a given height and column width for publication.
Type | Default | Details | |
---|---|---|---|
col | int | 1 | Number of columns the figure spans. |
width | float | None | |
height | float | None | |
ratio | float | None | Aspect ratio of the figure (height/width). |
Saving
easy_save
easy_save (name:str, fig:matplotlib.figure.Figure=None, formats=['svg'], dir=Path('/home/runner/work/beforerr_dev/beforerr_dev/figures' ), **kwargs)
Axes
unify_axes_fontsize
unify_axes_fontsize (obj:matplotlib.figure.Figure|matplotlib.axes._axes.A xes|list[matplotlib.axes._axes.Axes]|None=None, fontsize:str|float='medium')
Set the fontsize of all text elements in a matplotlib axis to the same value.
Type | Default | Details | |
---|---|---|---|
obj | matplotlib.figure.Figure | matplotlib.axes._axes.Axes | list[matplotlib.axes._axes.Axes] | None | None | a single axis or a list of axes |
fontsize | str | float | medium |
create_legends
create_legends (obj:matplotlib.figure.Figure|matplotlib.axes._axes.Axes|l ist[matplotlib.axes._axes.Axes]|None=None, **kwargs)
hide_ylabels
hide_ylabels (obj:matplotlib.figure.Figure|matplotlib.axes._axes.Axes|lis t[matplotlib.axes._axes.Axes]|None=None)
hide_xlabels
hide_xlabels (obj:matplotlib.figure.Figure|matplotlib.axes._axes.Axes|lis t[matplotlib.axes._axes.Axes]|None=None)
Lines
set_linewidth
set_linewidth (w, obj:matplotlib.figure.Figure|matplotlib.axes._axes.Axes |list[matplotlib.axes._axes.Axes]|None=None)
Legends
hide_legend_lines
hide_legend_lines (obj:matplotlib.figure.Figure|matplotlib.axes._axes.Axe s|list[matplotlib.axes._axes.Axes]|None=None)
Hide legend lines on all axes.
hide_legends
hide_legends (obj:matplotlib.figure.Figure|matplotlib.axes._axes.Axes|lis t[matplotlib.axes._axes.Axes]|None=None)
Hide legends on all axes.
sync_legend_colors
sync_legend_colors (obj:matplotlib.figure.Figure|matplotlib.axes._axes.Ax es|list[matplotlib.axes._axes.Axes]|None=None)
Synchronize legend text colors with their corresponding line colors.
Pipelines
update_rcParams
update_rcParams (plot_opts:__main__.PlotOpts)
process_figure
process_figure (obj, plot_opts:pydantic.main.BaseModel, **kwargs)
PlotOpts
PlotOpts (sync_legend_colors:bool=False, hide_legends:bool=False, hide_legend_lines:bool=False, hide_xlabels:bool=False, hide_ylabels:bool=False)
Options to apply to a matplotlib object.