PlotBin

3.1.8 · active · verified Thu Apr 16

The PlotBin package is a Python library, currently at version 3.1.8, developed by Michele Cappellari. It provides specialized utilities for plotting binned maps and other general two-dimensional data visualizations. Primarily aimed at scientific research and development, particularly in fields like astronomy and astrophysics, its documentation is embedded within the source code file headers. The project maintains an active status with irregular but consistent updates, with the latest release in September 2025.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to generate a binned 2D map using `plotbin.display_bins`. It simulates random x, y coordinates and associated 'z' values, then visualizes their binned representation with Matplotlib. It assumes a basic setup where x, y, and z represent data points and their corresponding values in a 2D space.

import numpy as np
from plotbin.display_bins import display_bins
import matplotlib.pyplot as plt

# Simulate some binned data (e.g., from a galaxy observation)
x = np.random.rand(100) * 10
y = np.random.rand(100) * 10
z = np.sin(x/2) + np.cos(y/2) + np.random.rand(100) * 0.5

# Create a simple display_bins plot
fig, ax = plt.subplots(figsize=(7, 6))
display_bins(x, y, z, ax=ax, cmap='viridis', textcolor='white')
ax.set_title('Example Binned Map with PlotBin')
ax.set_xlabel('X-coordinate')
ax.set_ylabel('Y-coordinate')
plt.colorbar(ax.collections[0], ax=ax, label='Value')
plt.show()

view raw JSON →