Skip to content

Commit dd97755

Browse files
gonzalocasasclaude
andcommitted
Initial commit: COMPAS 2.x port of compas_plotters
Revive compas_plotters (2D matplotlib visualisation, last shipped in COMPAS 1.17.x) as a standalone, release-ready package built on the modern compas.scene system. - Plotter class with full feature parity, including dynamic plots and GIF recording via Plotter.on. - "Plotter" visualisation context registering scene objects for Point, Vector, Line, Polyline, Polygon, Circle, Ellipse, Frame, Mesh and Graph. - Modern Python 3 style, fully type-hinted, numpy docstrings. - Scaffolding: pyproject, ruff, pytest (7 tests), mkdocs docs, CI workflows, bumpversion, CITATION. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
0 parents  commit dd97755

44 files changed

Lines changed: 2461 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build:
13+
if: "!contains(github.event.pull_request.labels.*.name, 'docs-only')"
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
os: [ubuntu-latest, macos-latest, windows-latest]
19+
python: ['3.9', '3.13']
20+
21+
steps:
22+
- uses: compas-dev/compas-actions.build@v5
23+
with:
24+
python: ${{ matrix.python }}
25+
invoke_lint: true
26+
invoke_test: true

.github/workflows/docs.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: docs
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- 'v*'
9+
pull_request_review:
10+
types: [submitted]
11+
12+
jobs:
13+
docs:
14+
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'pull_request_review' && github.event.review.state == 'approved')
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: compas-dev/compas-actions.docs@v5
18+
with:
19+
github_token: ${{ secrets.GITHUB_TOKEN }}
20+
doc_url: https://compas.dev/compas_plotters
21+
generator: mkdocs

.github/workflows/pr-checks.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: verify-pr-checklist
2+
3+
on:
4+
pull_request:
5+
types: [assigned, opened, synchronize, reopened, labeled, unlabeled]
6+
branches:
7+
- main
8+
9+
jobs:
10+
build:
11+
name: Check Actions
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v6
15+
- name: Changelog check
16+
if: "!contains(github.event.pull_request.labels.*.name, 'skip-changelog')"
17+
uses: Zomzog/changelog-checker@v1.1.0
18+
with:
19+
fileName: CHANGELOG.md
20+
checkNotification: Simple
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
on:
2+
push:
3+
tags:
4+
- 'v*'
5+
6+
name: Create Release
7+
8+
jobs:
9+
build:
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
matrix:
13+
os: [ubuntu-latest, macos-latest, windows-latest]
14+
python: ['3.9', '3.10', '3.11', '3.12', '3.13']
15+
16+
steps:
17+
- uses: compas-dev/compas-actions.build@v5
18+
with:
19+
python: ${{ matrix.python }}
20+
invoke_lint: true
21+
invoke_test: true
22+
23+
publish:
24+
needs: build
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: compas-dev/compas-actions.publish@v3
28+
with:
29+
pypi_token: ${{ secrets.PYPI_PASSWORD }}
30+
github_token: ${{ secrets.GITHUB_TOKEN }}
31+
release_name_prefix: COMPAS Plotters

.gitignore

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# Distribution / packaging
7+
.Python
8+
env/
9+
build/
10+
develop-eggs/
11+
dist/
12+
downloads/
13+
eggs/
14+
.eggs/
15+
lib/
16+
lib64/
17+
parts/
18+
sdist/
19+
var/
20+
wheels/
21+
*.egg-info/
22+
.installed.cfg
23+
*.egg
24+
25+
# Unit test / coverage reports
26+
htmlcov/
27+
.tox/
28+
.coverage
29+
.coverage.*
30+
.cache
31+
.pytest_cache/
32+
nosetests.xml
33+
coverage.xml
34+
*.cover
35+
36+
# Environments
37+
.env
38+
.venv
39+
venv/
40+
ENV/
41+
42+
# mkdocs documentation
43+
/site
44+
45+
# IDEs / OS
46+
.idea/
47+
.vscode/
48+
.DS_Store
49+
50+
# COMPAS / temp
51+
temp/
52+
*.gif

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## Unreleased
9+
10+
### Added
11+
12+
* Initial COMPAS 2.x port of `compas_plotters`.
13+
* `Plotter` class for 2D matplotlib visualisation, including dynamic plotting
14+
(`Plotter.on`) with optional GIF recording.
15+
* `"Plotter"` visualisation context built on `compas.scene`.
16+
* Scene objects for `Point`, `Vector`, `Line`, `Polyline`, `Polygon`, `Circle`,
17+
`Ellipse` and `Frame`.
18+
* Scene objects for the `Mesh` and `Graph` data structures, with vertex/edge/face
19+
and node/edge labels.
20+
21+
### Changed
22+
23+
### Removed

CITATION.cff

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
cff-version: 1.2.0
2+
message: "If you use this software, please cite it as below."
3+
title: "COMPAS Plotters: 2D visualisation for the COMPAS Framework"
4+
abstract: "2D visualisation of COMPAS geometry and data structures with matplotlib."
5+
type: software
6+
authors:
7+
- name: "ETH Zurich"
8+
affiliation: "ETH Zurich"
9+
- family-names: "Van Mele"
10+
given-names: "Tom"
11+
affiliation: "ETH Zurich"
12+
- family-names: "Casas"
13+
given-names: "Gonzalo"
14+
affiliation: "ETH Zurich"
15+
url: "https://github.com/compas-dev/compas_plotters"
16+
repository-code: "https://github.com/compas-dev/compas_plotters"
17+
license: MIT
18+
version: "0.1.0"
19+
date-released: 2026-06-30
20+
keywords:
21+
- COMPAS
22+
- visualisation
23+
- matplotlib
24+
- geometry
25+
- architecture

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2017-2026 ETH Zurich
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

MANIFEST.in

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
graft src
2+
3+
prune .github
4+
prune docs
5+
prune tests
6+
prune temp
7+
8+
include CHANGELOG.md
9+
include LICENSE
10+
include README.md
11+
include requirements.txt
12+
13+
exclude requirements-dev.txt
14+
exclude conftest.py
15+
exclude tasks.py
16+
exclude mkdocs.yml
17+
18+
global-exclude *.py[cod] __pycache__ .DS_Store

README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# COMPAS Plotters
2+
3+
![build](https://github.com/compas-dev/compas_plotters/workflows/build/badge.svg)
4+
[![License](https://img.shields.io/github/license/compas-dev/compas_plotters.svg)](https://github.com/compas-dev/compas_plotters/blob/main/LICENSE)
5+
[![PyPI](https://img.shields.io/pypi/v/compas_plotters.svg)](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

Comments
 (0)