poliastro2.plotting.orbit.backends.matplotlib

A module implementing orbit plotter backends based on Matplotlib.

Classes

Matplotlib2D([ax, use_dark_theme])

An orbit plotter backend class based on Matplotlib.

class poliastro2.plotting.orbit.backends.matplotlib.Matplotlib2D(ax=None, use_dark_theme=False)

An orbit plotter backend class based on Matplotlib.

_get_colors(color, trail)

Return the required list of colors if orbit trail is desired.

Parameters:
  • color (str) – A string representing the hexadecimal color for the point.

  • trail (bool) – True if orbit trail is desired, False if not desired.

Returns:

A list of strings representing hexadecimal colors.

Return type:

list[str]

property ax

The matplotlib axes were the scene is rendered.

Returns:

ax – The matplotlib Axes representing the scene.

Return type:

Axes

draw_axes_labels_with_length_scale_units(length_scale_units)

Draw the desired label into the specified axis.

Parameters:

lenght_scale_units (Unit) – Desired units of lenght used for representing distances.

draw_coordinates(coordinates, *, colors, dashed, label)

Draw desired coordinates into the scene.

Parameters:
  • coordinates (list[list[float, float, float]]) – A set of lists containing the x, y and z coordinates.

  • colors (list[str]) – A list of string representing the hexadecimal color for the coordinates.

  • dashed (bool) – Whether to use a dashed or solid line style for the coordiantes.

  • label (str) – The name to be used to identify the coordinates in the legend of the figure.

Returns:

trace_coordinates – An object representing the trace of the coordinates in the scene.

Return type:

Line2D

draw_impulse(position, *, color, label, size)

Draw an impulse into the scene.

Parameters:
  • position (list[float, float]) – A list containing the x and y coordinates of the impulse location.

  • color (str) – A string representing the hexadecimal color for the impulse marker.

  • label (str) – The name to be used to identify the position in the legend of the figure.

  • size (float) – The size of the marker for the impulse.

Returns:

An object representing the trace of the impulse in the scene.

Return type:

Line2D

draw_marker(position, *, color, label, marker_symbol, size)

Draw a marker into the scene.

Parameters:
  • position (list[float, float]) – A list containing the x and y coordinates of the point.

  • color (str) – A string representing the hexadecimal color for the point.

  • label (str) – The name to be used in the legend for the marker.

  • marker_symbol (str) – The marker symbol to be used when drawing the point.

  • size (float) – Desired size for the marker.

Returns:

An object representing the trace of the marker in the scene.

Return type:

Line2D

draw_position(position, *, color, label, size)

Draw the position of a body in the scene.

Parameters:
  • position (list[float, float, float]) – A list containing the x, y and z coordinates of the point.

  • color (str) – A string representing the hexadecimal color for the marker.

  • label (str) – The name to be used to identify the position in the legend of the figure.

  • size (float) – The size of the marker.

Returns:

An object representing the trace of the coordinates in the scene.

Return type:

Line2D

draw_sphere(position, *, color, label, radius)

Draw an sphere into the scene.

Parameters:
  • position (list[float, float]) – A list containing the x and y coordinates of the sphere location.

  • color (str) – A string representing the hexadecimal color for the sphere.

  • label (str) – The name shown in the legend of the figure to identify the sphere.

  • radius (float) – The radius of the sphere.

Returns:

An object representing the trace of the sphere in the scene.

Return type:

Patch

generate_labels(label, has_coordinates, has_position)

Generate the labels for coordinates and position.

Parameters:
  • label (str) – A string representing the label.

  • has_coordinates (boolean) – Whether the object has coordinates to plot or not.

  • has_position (boolean) – Whether the object has a position to plot or not.

Returns:

A tuple containing the coordinates and position labels.

Return type:

tuple

resize_limits()

Resize the limits of the scene.

show()

Display the scene.

undraw_attractor()

Remove the attractor from the scene.

update_legend()

Update the legend of the scene.

poliastro2.plotting.orbit.backends.matplotlib._segments_from_arrays(x, y)