visualization package
Project description
Cleopatra
Cleopatra is a matplotlib utility package for visualizing 2D/3D numpy arrays, unstructured meshes, and statistical histograms. It targets scientific and research users working with geospatial and raster data, providing a high-level API over matplotlib with sensible defaults and rich customization.
Main Features
ArrayGlyph -- Raster / Array Visualization
- Plot 2D numpy arrays with automatic colorbar and customizable color scales (linear, power, symmetric log-norm, boundary-norm, midpoint).
- Display cell values and overlay point markers on the plot.
- Animate 3D arrays over time and export to GIF, MP4, MOV, or AVI (via ffmpeg).
MeshGlyph -- Unstructured Mesh Visualization
- Visualize UGRID-style unstructured mesh data using triangulation (
tripcolor,tricontourf). - Render wireframe outlines via
LineCollection. - Accepts raw numpy arrays of node coordinates and face-node connectivity.
- Animate time-varying mesh data.
StatisticalGlyph -- Histogram Plots
- Create histograms for 1D and 2D datasets with customizable bins, colors, and transparency.
Colors -- Color Utilities
- Convert between hex, RGB (0-255), and normalized RGB (0-1) formats.
- Extract color ramps from images and create custom matplotlib colormaps.
Installation
pip
pip install cleopatra
conda
conda install -c conda-forge cleopatra
From source (latest development version)
pip install git+https://github.com/serapeum-org/cleopatra
Quick Start
Plot a 2D array
import numpy as np
from cleopatra.array_glyph import ArrayGlyph
arr = np.random.rand(10, 10)
glyph = ArrayGlyph(arr)
fig, ax = glyph.plot(title="Random Array")
Create a histogram
import numpy as np
from cleopatra.statistical_glyph import StatisticalGlyph
data = np.random.normal(0, 1, 1000)
stat = StatisticalGlyph(data)
fig, ax = stat.histogram(bins=30)
Plot an unstructured mesh
import numpy as np
from cleopatra.mesh_glyph import MeshGlyph
node_x = np.array([0.0, 1.0, 0.5, 1.5])
node_y = np.array([0.0, 0.0, 1.0, 1.0])
face_nodes = np.array([[0, 1, 2], [1, 3, 2]])
face_data = np.array([10.0, 20.0])
mg = MeshGlyph(node_x, node_y, face_nodes)
fig, ax = mg.plot(face_data, location="face", title="Mesh Data")
Requirements
- Python >= 3.11
- numpy >= 2.0.0
- matplotlib >= 3.8.4
Documentation
Full documentation is available at serapeum-org.github.io/cleopatra.
License
Cleopatra is licensed under the GNU General Public License v3.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cleopatra-0.8.0.tar.gz.
File metadata
- Download URL: cleopatra-0.8.0.tar.gz
- Upload date:
- Size: 2.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4128539f568782abea876d13f9e70e2137b980180ddd3b8753635b561682c6d
|
|
| MD5 |
969dc0d669a67bec21cc3c45be4279e1
|
|
| BLAKE2b-256 |
d0a666fd10f139b28674dd5dd3b9f3d56ac6295841face1102c6672f83e3f5a5
|
File details
Details for the file cleopatra-0.8.0-py3-none-any.whl.
File metadata
- Download URL: cleopatra-0.8.0-py3-none-any.whl
- Upload date:
- Size: 86.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ef276d0b671531624eeb1b3ca124638ea9dfa9db371b5d600731ebb0c17848b
|
|
| MD5 |
e942b1ee93f610b11ccf63e7a29e1bc9
|
|
| BLAKE2b-256 |
ae1d0188db950d861ee47c1f34fce307a1b404db8c836f7045a3d3531e044693
|