colour_visuals.VisualGrid#

class colour_visuals.VisualGrid(size: float = 20, centred: bool = True, major_grid_colours: ArrayLike = (0.5, 0.5, 0.5), minor_grid_colours: ArrayLike = (0.25, 0.25, 0.25), major_tick_labels: bool = True, major_tick_label_colours: ArrayLike = (0.75, 0.75, 0.75), minor_tick_labels: bool = True, minor_tick_label_colours: ArrayLike = (0.5, 0.5, 0.5))[source]#

Bases: MixinPropertySize, Visual

Create a 3D grid.

Parameters:
  • size (float) – Size of the grid.

  • centred (bool) – Whether to create the grid centred at the origin.

  • major_grid_colours (ArrayLike) – Colour of the major grid lines.

  • minor_grid_colours (ArrayLike) – Colour of the minor grid lines.

  • major_tick_labels (bool) – Whether to draw the major tick labels.

  • major_tick_label_colours (ArrayLike) – Colour of the major tick labels.

  • minor_tick_labels (bool) – Whether to draw the minor tick labels.

  • minor_tick_label_colours (ArrayLike) – Colour of the minor tick labels.

Attributes

Methods

Examples

>>> import os
>>> from colour.utilities import suppress_stdout
>>> from wgpu.gui.auto import WgpuCanvas
>>> with suppress_stdout():
...     canvas = WgpuCanvas(size=(960, 540))
...     scene = gfx.Scene()
...     scene.add(
...         gfx.Background(
...             None, gfx.BackgroundMaterial(np.array([0.18, 0.18, 0.18]))
...         )
...     )
...     visual = VisualGrid()
...     camera = gfx.PerspectiveCamera(50, 16 / 9)
...     camera.show_object(visual, up=np.array([0, 0, 1]), scale=1.25)
...     scene.add(visual)
...     if os.environ.get("CI") is None:
...         gfx.show(scene, camera=camera, canvas=canvas)
visual-grid
__init__(size: float = 20, centred: bool = True, major_grid_colours: ArrayLike = (0.5, 0.5, 0.5), minor_grid_colours: ArrayLike = (0.25, 0.25, 0.25), major_tick_labels: bool = True, major_tick_label_colours: ArrayLike = (0.75, 0.75, 0.75), minor_tick_labels: bool = True, minor_tick_label_colours: ArrayLike = (0.5, 0.5, 0.5)) None[source]#
Parameters:
  • size (float)

  • centred (bool)

  • major_grid_colours (ArrayLike)

  • minor_grid_colours (ArrayLike)

  • major_tick_labels (bool)

  • major_tick_label_colours (ArrayLike)

  • minor_tick_labels (bool)

  • minor_tick_label_colours (ArrayLike)

Return type:

None

property centred: bool#

Getter and setter property to create the grid centred at the origin.

Parameters:

value – Value to create the grid centred at the origin.

Returns:

Create the grid centred at the origin.

Return type:

bool

property major_grid_colours: ArrayLike#

Getter and setter property for the major grid colour.

Parameters:

value – Value to set the major grid colour with.

Returns:

Major grid colour.

Return type:

ArrayLike

property minor_grid_colours: ArrayLike#

Getter and setter property for the minor grid colour.

Parameters:

value – Value to set the minor grid colour with.

Returns:

Major grid colour.

Return type:

ArrayLike

property major_tick_labels: bool#

Getter and setter property for the major tick labels state.

Parameters:

value – Value to set major tick labels state with.

Returns:

Major tick labels state.

Return type:

bool

property major_tick_label_colours: ArrayLike#

Getter and setter property for the major tick label colour.

Parameters:

value – Value to set the major tick label colour with.

Returns:

Major tick label colour.

Return type:

ArrayLike

property minor_tick_labels: bool#

Getter and setter property for the minor tick labels state.

Parameters:

value – Value to set minor tick labels state with.

Returns:

Minor tick labels state.

Return type:

bool

property minor_tick_label_colours: ArrayLike#

Getter and setter property for the minor tick label colour.

Parameters:

value – Value to set the minor tick label colour with.

Returns:

Minor tick label colour.

Return type:

ArrayLike

update() None[source]#

Update the visual.

Return type:

None