|
| 1 | +# COMPAS Plotters |
| 2 | + |
| 3 | + |
| 4 | +[](https://github.com/compas-dev/compas_plotters/blob/main/LICENSE) |
| 5 | +[](https://pypi.org/project/compas_plotters/) |
| 6 | + |
| 7 | +**2D visualisation of COMPAS geometry and data structures, powered by matplotlib.** |
| 8 | + |
| 9 | +`compas_plotters` provides a lightweight, dependency-free (other than matplotlib) |
| 10 | +way to draw COMPAS objects in 2D. It is the COMPAS 2.x successor of the |
| 11 | +`compas_plotters` package that shipped inside COMPAS up to version 1.17, rebuilt |
| 12 | +on top of the modern [`compas.scene`](https://compas.dev/compas/latest/) system. |
| 13 | +It registers a `"Plotter"` visualisation context, so any COMPAS object with a |
| 14 | +registered plotter scene object can be drawn with a single `plotter.add(...)`. |
| 15 | + |
| 16 | +## Installation |
| 17 | + |
| 18 | +```bash |
| 19 | +pip install compas_plotters |
| 20 | +``` |
| 21 | + |
| 22 | +## Quick start |
| 23 | + |
| 24 | +```python |
| 25 | +from compas.geometry import Point, Line, Polygon |
| 26 | +from compas.datastructures import Mesh |
| 27 | +from compas_plotters import Plotter |
| 28 | + |
| 29 | +plotter = Plotter(figsize=(8, 5)) |
| 30 | + |
| 31 | +mesh = Mesh.from_polyhedron(8) |
| 32 | +plotter.add(mesh, show_vertices=True, show_edges=True) |
| 33 | +plotter.add(Polygon([[0, 0, 0], [3, 0, 0], [3, 3, 0]]), facecolor=(0.9, 0.9, 1.0)) |
| 34 | +plotter.add(Line(Point(0, 0, 0), Point(3, 3, 0)), linecolor=(1, 0, 0)) |
| 35 | +plotter.add(Point(1.5, 1.5, 0)) |
| 36 | + |
| 37 | +plotter.zoom_extents() |
| 38 | +plotter.show() |
| 39 | +``` |
| 40 | + |
| 41 | +## Supported objects |
| 42 | + |
| 43 | +| Category | Objects | |
| 44 | +|---|---| |
| 45 | +| Geometry | `Point`, `Vector`, `Line`, `Polyline`, `Polygon`, `Circle`, `Ellipse`, `Frame` | |
| 46 | +| Data structures | `Mesh`, `Graph` | |
| 47 | + |
| 48 | +3D shapes (`Box`, `Sphere`, …), `Brep`, `Surface` and `VolMesh` are not yet |
| 49 | +supported — see the [roadmap](https://compas.dev/compas_plotters). |
| 50 | + |
| 51 | +## Documentation |
| 52 | + |
| 53 | +Full documentation is available at |
| 54 | +[compas.dev/compas_plotters](https://compas.dev/compas_plotters). |
| 55 | + |
| 56 | +## License |
| 57 | + |
| 58 | +`compas_plotters` is released under the [MIT License](LICENSE). |
0 commit comments