graphinglib.SmartFigureWCS.set_grid#

SmartFigureWCS.set_grid(visible_x: bool = True, visible_y: bool = True, 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.

Note

Contrary to the SmartFigure class, this method does not support plotting grid lines for minor ticks. This is because the astropy.visualization.wcsaxes.WCSAxes do not support minor ticks for the grid lines.

Parameters:
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.

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)).