2D visualisation of COMPAS geometry and data structures, powered by matplotlib.
compas_plotters provides a lightweight, dependency-free (other than matplotlib)
way to draw COMPAS objects in 2D. It is the COMPAS 2.x successor of the
compas_plotters package that shipped inside COMPAS up to version 1.17, rebuilt
on top of the modern compas.scene system.
It registers a "Plotter" visualisation context, so any COMPAS object with a
registered plotter scene object can be drawn with a single plotter.add(...).
pip install compas_plottersfrom compas.geometry import Point, Line, Polygon
from compas.datastructures import Mesh
from compas_plotters import Plotter
plotter = Plotter(figsize=(8, 5))
mesh = Mesh.from_polyhedron(8)
plotter.add(mesh, show_vertices=True, show_edges=True)
plotter.add(Polygon([[0, 0, 0], [3, 0, 0], [3, 3, 0]]), facecolor=(0.9, 0.9, 1.0))
plotter.add(Line(Point(0, 0, 0), Point(3, 3, 0)), linecolor=(1, 0, 0))
plotter.add(Point(1.5, 1.5, 0))
plotter.zoom_extents()
plotter.show()| Category | Objects |
|---|---|
| Geometry | Point, Vector, Line, Polyline, Polygon, Circle, Ellipse, Frame |
| Shapes (drawn as XY projections) | Box, Sphere, Cylinder, Cone, Capsule, Torus, Polyhedron |
| Data structures | Mesh, Graph |
Brep, Surface, NurbsCurve, VolMesh and Plane are not yet supported —
see the roadmap.
Planned additions, most likely drawn as XY projections following the existing
ShapeObject:
BrepandSurface(tessellate to a mesh, then project;Brepneeds an optional backend such ascompas_occ)NurbsCurve(sampled to a polyline)VolMeshandPlane
Full documentation is available at compas.dev/compas_plotters.
compas_plotters is released under the MIT License.