gsplot.style.label#
Functions
|
Configures labels, limits, ticks, and layouts for Matplotlib axes. |
|
Adds index labels to axes in a Matplotlib figure. |
- label(lab_lims, xpad_label=5, ypad_label=5, minor_ticks_axes=True, tight_layout=True, xpad_layout=2, ypad_layout=2, *args, **kwargs)[source]#
Configures labels, limits, ticks, and layouts for Matplotlib axes.
This function is a wrapper for the Label class.
- Parameters:
lab_lims (
list[Any]
) – A list specifying labels and limits for each axis in the figure. Each entry should be a tuple of the form (x_label, y_label, x_limits, y_limits).xpad_label (
int
orfloat
, default5
) – Padding for the x-axis label.ypad_label (
int
orfloat
, default5
) – Padding for the y-axis label.minor_ticks_axes (
bool
, defaultTrue
) – Whether to add minor ticks to all axes.tight_layout (
bool
, defaultTrue
) – Whether to apply tight_layout to the figure.xpad_layout (
int
, default2
) – Horizontal padding for tight layout.ypad_layout (
int
, default2
) – Vertical padding for tight layout.*args (
Any
) – Additional arguments for ax.set_xlabel and `ax.set_ylabel.**kwargs (
Any
) – Additional keyword arguments for ax.set_xlabel and ax.set_ylabel.
Notes
This function utilizes the ParamsGetter to retrieve bound parameters and the CreateClassParams class to handle the merging of default, configuration, and passed parameters.
- Return type:
Warning
This function should be called before the
gsplot.label_add_index
functionExamples
>>> import gsplot as gs >>> gs.label( >>> lab_lims=[("X Label", "Y Label", [1, 10, "log"], [1, 20, 2])], >>> xpad_layout=5, >>> ypad_layout=5, >>> )
- label_add_index(loc='out', x_offset=0, y_offset=0, ha='center', va='center', fontsize='large', glyph='alphabet', capitalize=False, *args, **kwargs)[source]#
Adds index labels to axes in a Matplotlib figure.
This function is a wrapper for the LabelAddIndex class.
- Parameters:
loc (
{'in', 'out', 'corner'}
, default'out'
) – Location of the label relative to the axes.x_offset (
float
, default0
) – Horizontal offset for the label position.y_offset (
float
, default0
) – Vertical offset for the label position.ha (
str
, default'center'
) – Horizontal alignment of the label.va (
str
, default'center'
) – Vertical alignment of the label.fontsize (
str
orfloat
, default'large'
) – Font size of the label.glyph (
{'alphabet', 'roman', 'number', 'hiragana'}
, default'alphabet'
) – Style of the label.capitalize (
bool
, defaultFalse
) – If True, capitalize the label.*args (
Any
) – Additional arguments for matplotlib.text.Text.**kwargs (
Any
) – Additional keyword arguments for matplotlib.text.Text.
Notes
This function utilizes the ParamsGetter to retrieve bound parameters and the CreateClassParams class to handle the merging of default, configuration, and passed parameters.
- Return type:
Warning
This function should be called after the
gsplot.label
functionExamples
>>> import gsplot as gs >>> gs.label_add_index(loc='out', glyph='roman', fontsize=12) >>> gs.label_add_index(loc='corner', capitalize=True)