CartesianPlotter#

class sunkit_pyvista.CartesianPlotter(*args, **kwargs)[source]#

Bases: SaveMixIn, Plotter

A plotter for 3D data in a Cartesian box.

This class inherits pyvista.Plotter. It is used to visualize 3D vector field lines (e.g., magnetic field lines of solar active regions) traced by streamtracer.

Parameters:

kwargs (dict) – All other keyword arguments are passed through to pyvista.Plotter.

Initialize a vtk plotting object.

Methods Summary

define_vector_field(vectors, *args, **kwargs)

Define a 3D vector field.

plot_field_lines(seeds, *[, ...])

Plot field lines traced from seeds using streamtracer.StreamTracer.

show_boundary([boundary, component, cmap])

Show the boundary of the 3D vector field.

show_outline([color])

Show the outline of the 3D vector field.

Methods Documentation

define_vector_field(vectors, *args, **kwargs)[source]#

Define a 3D vector field.

Parameters:
plot_field_lines(
seeds,
*,
render_lines_as_tubes=True,
radius=1,
max_steps=10000,
step_size=0.1,
seeds_config={'color': 'red', 'point_size': 5, 'show_seeds': False},
**kwargs,
)[source]#

Plot field lines traced from seeds using streamtracer.StreamTracer.

Parameters:
  • seeds (numpy.ndarray) – A (N, 3) array representing the seeds.

  • render_lines_as_tubes (bool, optional) – Whether to render field lines as tubes. Default is True.

  • radius (float, optional) – The radius of the tubes for rendering field lines. Default is 1.

  • max_steps (int, optional) – The maximum number of steps for tracing field lines. Default is 10000.

  • step_size (float, optional) – The step size for tracing field lines. Default is 0.1.

  • seeds_config (dict, optional) – Configuration for plotting seeds. Default is dict(show_seeds=False, color=’red’, point_size=5).

  • kwargs (dict) – Keyword arguments for pyvista.Plotter.add_mesh.

show_boundary(
boundary='bottom',
*,
component=2,
cmap='gray',
**kwargs,
)[source]#

Show the boundary of the 3D vector field.

Parameters:
  • boundary (str, optional) – The boundary to be plotted. ‘bottom’, ‘top’, ‘left’, ‘right’, ‘front’, or ‘back’. Default is ‘bottom’.

  • component (int, optional) – The component of the vector field to be plotted. 0, 1, or 2 for x, y, or z component, respectively. Default is 2.

  • cmap (str, optional) – The colormap for the boundary. Default is ‘gray’.

  • kwargs (dict) – Keyword arguments for pyvista.Plotter.add_mesh.

show_outline(color='black', **kwargs)[source]#

Show the outline of the 3D vector field.

Parameters: