Plotter

class compas_plotters.plotter.Plotter(view=((- 8.0, 16.0), (- 5.0, 10.0)), figsize=(8.0, 5.0), dpi=100, bgcolor=(1.0, 1.0, 1.0), show_axes=False, zstack='zorder')[source]

Bases: object

Plotter for the visualization of COMPAS geometry.

Parameters
  • view (tuple[tuple[float, float], tuple[float, float]], optional) – The area of the axes that should be zoomed into view.

  • figsize (tuple[float, float], optional) – Size of the figure in inches.

  • dpi (float, optional) – Resolution of the figure in “dots per inch”.

  • bgcolor (tuple[float, float, float], optional) – Background color for the figure canvas.

  • show_axes (bool, optional) – If True, show the axes of the figure.

  • zstack ({‘natural’, ‘zorder’}, optional) – If 'natural', the drawing elements appear in the order they were added. If 'natural', the drawing elements are added based on their zorder.

Attributes
  • viewbox (tuple[tuple[float, float], tuple[float, float]]) – X min-max and Y min-max of the area of the axes that is zoomed into view.

  • axes (matplotlib.axes.Axes, read-only) – matplotlib axes object used by the figure. For more info, see the documentation of the Axes class (1) and the axis and tick API (2).

  • figure (matplotlib.figure.Figure, read-only) – matplotlib figure instance. For more info, see the figure API (3).

  • bgcolor (tuple[float, float, float]) – Background color of the figure.

  • title (str) – Title of the plot.

  • artists (list[compas_plotters.artists.PlotterArtist]) – Artists that should be included in the plot.

Class Attributes

fontsize (int) – Default fontsize used by the plotter.

References

1

https://matplotlib.org/api/axes_api.html

2

https://matplotlib.org/api/axis_api.html

3

https://matplotlib.org/api/figure_api.html

Examples

>>> from compas.geometry import Point, Plane, Circle
>>> from compas_plotters.plotter import Plotter

Create a plotter instance.

>>> plotter = Plotter()

Add COMPAS objects.

>>> plotter.add(Point(0, 0, 0))
<compas_plotters.artists.pointartist.PointArtist object at 0x17880eb80>
>>> plotter.add(Circle(Plane.worldXY(), 1.0))
<compas_plotters.artists.circleartist.CircleArtist object at 0x10d136e80>

Methods

add

Add a COMPAS geometry object or data structure to the plot.

add_from_list

Add multiple COMPAS geometry objects and/or data structures from a list.

draw

Draw all objects included in the plot.

find

Find a geometry object or data structure in the plot.

on

Method for decorating callback functions in dynamic plots.

pause

Pause plotting during the specified interval.

redraw

Updates and pauses the plot.

register_listener

Register a listener for pick events.

save

Saves the plot to a file.

show

Displays the plot.

zoom_extents

Zoom the view to the bounding box of all objects.