slitflow.fig.style module
- class Basic(info_path=None)[source]
Bases:
FigureBasic figure style for A4 paper size.
This class is valid only if there is only one axes in Figure. This class is used to change matplotlib’s figure format in a convenient way. The default setting is to create a quarter-width square graphic image on an A4 size document.
- Parameters:
reqs[0] (Figure) – Figure class object.
param["size"] (list of float, optional) – [width, height] of figure image (cm). Defaults to [4.5, 4.5].
param["margin"] (list of float, optional) – [left, bottom, right, top] of figure margin (cm). Defaults to [0.9, 0.6, 0.1, 0.4].
param["limit"] (list of float, optional) – [x_lower, x_upper, y_lower, y_upper] limits of figure. If x_lower = None, skip X limits.
param["tick"] (list of list of float, optional) – Tick position float lists for X and Y axes.
numpy.ndarrayis available, e.g., [np.arange(0, 1, 0.1), [0, 1, 2]].param["tick_label"] (list of list of str, optional) – Tick label for [x-axis, y-axis].
param["format"] (list of str, optional) – Strings for X and tick formats, e.g. [“%.0f”,”%.1f”].
param["is_box"] (bool, optional) – Draw box lined axis, if True.
param["line_widths"] (float or list of float, optional) – Line width. Defaults to 1.
param["line_styles"] (str or list of str, optional) – Line style.
param["line_colors"] (list of RGB 0-255, optional) – Line color. e.g., [[0, 0, 255]] is blue. Palette name is also available.
param["error_thicknesses"] (list of float, optional) – Error bar line width. Defaults to 1.
param["error_line_styles"] (list of str, optional) – Error bar line style.
param["error_cap_sizes"] (list of float, optional) – Error bar cap line width.
param["marker_styles"] (str or list of str, optional) – Marker style.
param["marker_colors"] (list of list of RGB 0-255, optional) – Marker edge and face colors. e.g., [[[0,0,0]],[[100,100,100]]]. List of palette_name is also available.
param["marker_widths"] (float or list of float, optional) – Marker widths.
param["marker_sizes"] (float or list of float, optional) – Marker sizes.
param["bar_widths"] (float or list of float) – Width of each bar.
param["label"] (list of str, optional) – [X label string, Y label string] for axes label texts.
param["legend"] (list, optional) – [list of label strings, handle indexes of artists to create a legend, keyword arguments for matplotlib legend]. If [None, None], then delete all legends. If handle indexes are None, e.g. [[“Label1”, “Label2”], None] then create legend for all artists. If only handle indexes are specified, e.g. [None, [0,1]], then create legend for selected artists with existing labels. Keyword arguments should be dictionary, e.g. {“loc”: “center”}.
param["log_scale"] (list of bool) – Change axes to the log scale. e.g., [False, True] means that the only y-axis is the log scale.
param["title"] (str, optional) – String for the figure title.
param["clim"] (list of float, optional) – [vmin, vmax] of colormap limit.
param["cmap"] (str, optional) – Colormap name. See also matplotlib.colormaps.
- Returns:
Styled Figure object
- Return type:
- save_data(data, path)[source]
matplotlib.pyplot.clf()is removed to avoid deleting the finalmatplotlib.figure.Figureobject.
- static process(reqs, param)[source]
Basic figure style for A4 paper size.
- Parameters:
reqs[0] (matplotlib.figure.Figure) – Figure object.
param (dict) – See class args description.
- Returns:
Styled Figure object
- Return type:
- class ParamTable(info_path=None)[source]
Bases:
BasicSet figure style from the parameter table.
The parameter dictionary of
Basicis replaced asTableto set different style values for split figures.- Parameters:
- Returns:
Styled Figure object
- Return type:
- static process(reqs, param)[source]
Basic figure style for A4 paper size.
- Parameters:
reqs[0] (matplotlib.figure.Figure) – Figure object.
- Returns:
Styled Figure object
- Return type:
- class ColorBar(info_path=None)[source]
Bases:
FigureCreate color bar figure from mappable figure object.
- Parameters:
reqs[0] (Figure) – Figure containing mappable object.
param["size"] (list of float, optional) – [width, height] of figure image (cm). Defaults to [4.5, 0.9].
param["margin"] (list, optional) – [Left, bottom, right, top] of figure margin (cm). Defaults to [0.2, 0.7, 0.2, 0.05].
param["is_vertical"] (bool, optional) – Whether colorbar orientation is vertical. Defaults to False.
param["label"] (str, optional) – Colorbar label string.
param["tick"] (list of float, optional) – List of colorbar tick values.
param["format"] (str, optional) – Tick value format string. e.g. “%.0f”.
- Returns:
Styled colorbar Figure object
- Return type:
- static process(reqs, param)[source]
Create color bar figure from mappable figure object.
- Parameters:
reqs[0] (matplotlib.figure.Figure) – Figure containing mappable.
param (dict) – See the class args description.
- Returns:
Styled Figure object
- Return type:
- set_legend(fig, labels=None, handle_indexes=None, kwargs={}, axes_no=0)[source]
Set figure legend.
- Parameters:
fig (matplotlib.figure.Figure) – Figure object.
labels (list of str) – List of label strings for each artists such as Line2D.
handle_indexes (list of int) – Index number list of artists to be included to the legend.
kwargs (dict) – Keyword arguments for
matplotlib.pyplot.legend().
- Returns:
Figure object with legend
- Return type:
Caution
All artists to be candidates for the legend should have labels during their creation.
- set_lim(fig, x_lim=None, y_lim=None, axes_no=0)[source]
Set limit without changing tick and format.
- set_tickformat(fig, x_format, y_format, axes_no=0)[source]
Set tick format without changing the style.
- set_linewidth(fig, line_widths, axes_no=0)[source]
Set widths of lines.
- Parameters:
fig (matplotlib.figure.Figure) – Figure containing line artists.
line_widths (float or list of float) – Resizes line widths. All lines are resized according to the same value if set as a float.
- Returns:
Restyled Figure object
- Return type:
- set_linecolor(fig, line_colors, axes_no=0)[source]
Set colors of all line artists.
- Parameters:
fig (matplotlib.figure.Figure) – Figure object.
line_colors (list of list) – [RGB values,…]. RGB values should be [R(0-255), G(0-255), B(0-255)].
- Returns:
Restyled Figure object
- Return type:
- set_markerstyle(fig, marker_styles, axes_no=0)[source]
Change line styles in bulk or individually.
Caution
Scatter plots can not change marker style.
- set_markercolor(fig, edge_colors, face_colors, axes_no=0)[source]
Set edge and face colors of all artists.
- set_errorthickness(fig, error_thicknesses, axes_no=0)[source]
Set widths of lines.
- Parameters:
fig (matplotlib.figure.Figure) – Figure containing line artists.
line_widths (float or list of float) – Resizes line widths. All lines are resized according to the same value if set as a float.
- Returns:
Restyled Figure object
- Return type:
- set_errorlinestyle(fig, error_line_styles, axes_no=0)[source]
Change error line styles in bulk or individually.
- set_errorcolor(fig, error_colors, axes_no=0)[source]
Set colors of all line artists.
- Parameters:
fig (matplotlib.figure.Figure) – Figure object.
line_colors (list of list) – [RGB values,…]. RGB values should be [R(0-255), G(0-255), B(0-255)].
- Returns:
Restyled Figure object
- Return type:
- is_boxed(fig, bool=True, axes_no=0)[source]
Show a rectangle-shaped box if True. Delete axes lines if False.
- is_log_scale(fig, bools, axes_no=0)[source]
Change X and Y axes to the log scale.
- Parameters:
fig (matplotlib.figure.Figure) – Figure object.
bools (list or bool) – Change axes to the log scale. e.g., [False, True] means that the only y-axis is the log scale.
- Returns:
Restyled Figure object
- Return type: