graphinglib.Figure.set_grid#
- Figure.set_grid(visible_x: bool = True, visible_y: bool = True, which_x: Literal['both', 'major', 'minor'] = 'both', which_y: Literal['both', 'major', 'minor'] = 'both', color: str | Inherit = Inherit, alpha: float | Inherit = Inherit, line_style: str | Inherit = Inherit, line_width: float | Inherit = Inherit) None[source]#
Sets the grid parameters for the figure.
- Parameters:
- visible_xbool, optional
If
True, sets the x-axis grid visible. Defaults toTrue.- visible_ybool, optional
If
True, sets the y-axis grid visible. Defaults toTrue.- which_x{“both”, “major”, “minor”}, optional
Sets whether both, only major or only minor grid lines are shown for the x-axis. Defaults to
"both".- which_y{“both”, “major”, “minor”}, optional
Sets whether both, only major or only minor grid lines are shown for the y-axis. Defaults to
"both".- 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.
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)).