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 to False.

visible_x, visible_ybool, optional

If True, sets the x-axis or y-axis grid visible. If False, the grid is not shown for the respective axis. Defaults to True for 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_style configuration.

alphafloat, optional

Sets the alpha value for the grid lines. Range is 0 (transparent) to 1 (opaque). Default depends on the figure_style configuration.

line_stylestr, optional

Sets the line style of the grid lines. Values include "-", "--", "-.", ":", "solid", "dashed", "dashdot", and "dotted". Default depends on the figure_style configuration.

line_widthfloat, optional

Sets the line width of the grid lines. Typical range is 0.5 to 3. Default depends on the figure_style configuration.

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 between 0 and 1 ((0, 0, 1) or (0, 0, 1, 0.5)).