graphinglib.SmartFigure.set_grid#
- SmartFigure.set_grid(reset: bool = False, visible_x: bool = True, visible_y: bool = True, which_x: Literal['major', 'minor', 'both'] = 'both', which_y: Literal['major', 'minor', 'both'] = 'both', color: str | Inherit = Inherit, alpha: float | Inherit = Inherit, line_style: str | Inherit = Inherit, line_width: float | Inherit = Inherit) Self[source]#
Sets the grid parameters for the figure.
- Parameters:
- resetbool, optional
If
True, resets all previously set grid parameters to their default values before applying the new parameters. Defaults toFalse.- visible_x, visible_ybool, optional
If
True, sets the x-axis or y-axis grid visible. IfFalse, the grid is not shown for the respective axis. Defaults toTruefor both axes.- which_x, which_yLiteral[“major”, “minor”, “both”], optional
Sets whether major, minor or both grid lines are shown for the x-axis and y-axis respectively. Defaults to
"both"for both axes.- colorstr, optional
Sets the color of the grid lines. Default depends on the
figure_styleconfiguration.- alphafloat, optional
Sets the alpha value for the grid lines. Range is
0(transparent) to1(opaque). Default depends on thefigure_styleconfiguration.- line_stylestr, optional
Sets the line style of the grid lines. Values include
"-","--","-.",":","solid","dashed","dashdot", and"dotted". Default depends on thefigure_styleconfiguration.- line_widthfloat, optional
Sets the line width of the grid lines. Typical range is
0.5to3. Default depends on thefigure_styleconfiguration.
- Returns:
- Self
For convenience, the same SmartFigure with the updated grid parameters.
Notes
Color parameters accept Matplotlib color formats: named colors (
"blue"), short color strings ("b"), hex strings ("#0000ff"), grayscale strings ("0.5"), and RGB/RGBA tuples with values between0and1((0, 0, 1)or(0, 0, 1, 0.5)).