
Security News
NIST Under Federal Audit for NVD Processing Backlog and Delays
As vulnerability data bottlenecks grow, the federal government is formally investigating NIST’s handling of the National Vulnerability Database.
A high-performance drop-in replacement for Matplotlib's 3D plotting capabilities, optimized for rendering large datasets from PDE solvers and other scientific applications.
import numpy as np
import matplotlib.pyplot as plt
from mpl3d_turbo import fast_plot_surface
# Create data
x = np.linspace(-5, 5, 1000)
y = np.linspace(-5, 5, 1000)
X, Y = np.meshgrid(x, y)
Z = np.sin(np.sqrt(X**2 + Y**2))
# Create 3D plot
fig = plt.figure(figsize=(10, 8))
ax = fig.add_subplot(111, projection='3d')
# Use accelerated surface plotting
surf = fast_plot_surface(ax, X, Y, Z, cmap='viridis',
rstride=1, cstride=1)
plt.show()
pip install mpl3d-turbo
# Install maturin if not already installed
pip install maturin
# Navigate to the project directory
cd mpl3d-turbo
# Build and install
maturin develop --release
# Navigate to project directory
cd mpl3d-turbo
# Build Rust library
cargo build --release
# Install Python package (development mode)
pip install -e python/
Dataset Size | Standard Matplotlib | mpl3d-turbo | Speedup |
---|---|---|---|
100x100 | 0.032s | 0.030s | 1.09x |
200x200 | 0.049s | 0.036s | 1.37x |
500x500 | 0.115s | 0.080s | 1.44x |
1000x1000 | 0.354s | 0.217s | 1.63x |
Memory usage is typically 3-5x lower with mpl3d-turbo, especially for larger datasets.
To run performance benchmarks yourself, execute:
python performance_test.py
Replace standard Matplotlib's plot_surface
call with our fast_plot_surface
:
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from mpl3d_turbo import fast_plot_surface
# Create 3D figure
fig = plt.figure(figsize=(12,8))
ax = fig.add_subplot(111, projection='3d')
# Generate mesh grid
X, Y = np.meshgrid(x, y)
Z = compute_surface(X, Y) # Your computation here
# Use accelerated surface plotting with all the same parameters as plot_surface
surf = fast_plot_surface(ax, X, Y, Z, cmap='viridis',
rstride=5, cstride=5)
ax.set_xlabel('X'), ax.set_ylabel('Y'), ax.set_zlabel('Z')
fig.colorbar(surf, shrink=0.5)
plt.title('Accelerated 3D Surface Plot')
plt.show()
mpl3d-turbo reimplements Matplotlib's core 3D rendering components with:
This approach provides significant performance improvements for large datasets, particularly for visualizing PDE solutions, terrain data, and other scientific applications.
Run example.py
to see a complete demonstration, including performance comparison.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
High-performance Matplotlib 3D plotting library implemented in Rust
We found that mpl3d-turbo demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
As vulnerability data bottlenecks grow, the federal government is formally investigating NIST’s handling of the National Vulnerability Database.
Research
Security News
Socket’s Threat Research Team has uncovered 60 npm packages using post-install scripts to silently exfiltrate hostnames, IP addresses, DNS servers, and user directories to a Discord-controlled endpoint.
Security News
TypeScript Native Previews offers a 10x faster Go-based compiler, now available on npm for public testing with early editor and language support.