Skip to content

1. Create an empty plot

Full example code: examples/visualization/visualization_step_1.py

To plot something, we must initialize a plot, add objects to it and finally render the result.

To create a plot or several subplots, we use the Plot and Subplots classes. To show the plot, call the start() method.

from dgmr.visualization.renderer import Plot, Subplots

# Single plot
plot = Plot(width=640, height=480)
plot.start()

# Plot with 2 subplots
subplots = Subplots(640, 480, ncols=2, nrows=1, shared_camera=False)
subplots.start()

Find and run this example at examples/visualization/visualization_step_1.py.

The following keyword arguments can be passed to set up your plot

Keyword Default value Description
width 800 Plot width
height 600 Plot height
background (26, 51, 102) RGB background color of the plot

Subplots have a few additional options you can set

Keyword Default value Description
ncols 1 Number of horizontal subplots
nrows 1 Number of vertical subplots
shared_camera True Share camera viewpoint between subplots

← Previous: Visualization Next: Add an object to your plot →