differt.plotting.draw_rays

Contents

differt.plotting.draw_rays#

draw_rays(ray_origins, ray_directions, *, ratio=0.1, **kwargs)[source]#

Plot a batch of rays.

Parameters:
Return type:

Any

Returns:

The resulting plot output.

Specific keyword rules for Plotly's backend

The following keyword arguments have a special meaning:

  • color: the color of the rays;

  • name: the name of the rays;

The following keyword arguments are passed to the line plot:

  • legendgroup=name;

  • line_color=color;

  • mode="lines";

  • showlegend=False.

The following keyword arguments are passed to the cone plot (i.e., arrow head):

  • colorscale=[color, color];

  • hoverinfo="name";

  • legendgroup=name;

  • name=name;

  • showscale=False;

  • showlegend=True;

  • sizemode="raw".

If you wish to override any of the above arguments, or add any additional, you can use the following keyword arguments:

  • cone_kwargs: a mapping of keyword arguments passed to Cone;

  • line_kwargs: a mapping of keyword arguments passed to Scatter3d;

Other keyword arguments are passed to both constructors.

Examples

The following example shows how to plot rays.

>>> from differt.geometry import fibonacci_lattice
>>> from differt.plotting import draw_rays
>>>
>>> ray_origins = jnp.zeros(3)
>>> ray_directions = fibonacci_lattice(50)
>>> ray_origins, ray_directions = jnp.broadcast_arrays(
...     ray_origins, ray_directions
... )
>>> fig = draw_rays(
...     ray_origins,
...     ray_directions,
...     backend="plotly",
... )
>>> fig