Matplotlib helpers#

module:

navground.sim.pyplot_helpers

Helpers to plot simulations using matplotlib

Plots an agent as a disc together with: - a smaller dot to indicate the direction - an optional arrow for its velocity - an optional circle for the safety margin

Parameters:
  • ax – The pyplot axes

  • agent – The agent

  • pose – A pose that override the agent own pose.

  • velocity – A velocity that override the agent own velocity.

  • velocity_arrow_width – The width of the velocity arrow

  • color – The color

  • alpha – The opacity

  • dot_color – The color of the dot

  • dot_radius – The relative radius of the dot as fraction of the radius

  • with_safety_margin – Whether to display the safety margin

Plots a world.

Parameters:
  • ax – The pyplot axes

  • world – The world

  • obstacles_color – The color of obstacles and walls

  • in_box – Whether to restrict the plot within the world bounding box

  • no_ticks – Whether to remove the axis ticks

  • with_agents – Whether to plot agents

  • kwargs – Keywords passed to plot_agent()

Plots a trajectory composed by an array of poses (x, y, theta)

Parameters:
  • ax – The pyplot axes

  • poses – The poses

  • color – The color

  • agent – The agent to display or none

  • step – The regular step at which to display the agent if provided or a dot

  • label – The label

  • kwargs – Keywords passed to plot_agent()

Plots an experimental run

Parameters:
  • ax – The pyplot axes

  • run – The run

  • agent_indices – The indices of the agents whose trajectory should be plotted.

  • step – The regular step at which to display the agent if provided or a dot

  • label – The label

  • with_agent – Whether to display agents

  • color – A function to assign a color to an agent. If not provided, it will fallback to the agent’s own color.

  • agent_kwargs – Keywords arguments passed to plot_agent()

  • with_world – Whether to display the world

  • world_kwargs – Keywords arguments passed to plot_world()