Python package making it easier to handle mixed 3d and 2d subplots.
Project description
Python package making it easier to handle mixed 3d and 2d subplots.
How do I install this package?
As usual, just download it using pip:
pip install ddd_subplots
Tests Coverage
Since some software handling coverages sometime get slightly different results, here’s three of them:
Usage Example
3D subplots
To get a set of 3d subplots just import subplots:
from ddd_subplots import subplots
fig, axes = subplots(1, 3, figsize=(15, 5))
Rotating 3D scatter plots
The library also offers a method to render 3D scatter plots. Here’s a complete example:
from ddd_subplots import subplots, rotate
import numpy as np
from sklearn import datasets
from sklearn.decomposition import PCA
def my_func(xs: np.ndarray, ys: np.ndarray, zs: np.ndarray, *args, **kwargs):
fig, axes = subplots(1, 3, figsize=(9, 3))
axs = axes.flatten()
axs[0].scatter(xs, ys, zs, **kwargs)
axs[1].scatter(ys, zs, xs, **kwargs)
axs[2].scatter(zs, xs, ys, **kwargs)
fig.tight_layout()
return fig, axes
X, y = datasets.load_iris(return_X_y=True)
X_reduced = PCA(n_components=3).fit_transform(X)
colors = np.array(["red", "green", "blue"])[y]
rotate(my_func, *X_reduced.T, path="test.gif",
duration=2, fps=24, c=colors, marker='o', s=20)
Output:
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
ddd_subplots-1.0.18.tar.gz
(6.4 kB
view details)
File details
Details for the file ddd_subplots-1.0.18.tar.gz.
File metadata
- Download URL: ddd_subplots-1.0.18.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ed595abaa46f97efc41b182ee7230f9bb4b87e198ab5df88b5a10c490193978
|
|
| MD5 |
0dbb1e0786b3d2f68fb4808ecf63d8e9
|
|
| BLAKE2b-256 |
5e799ca90c781577bc6ab5df97c40d1c819bff047cf058f9b8ad15b0c1ea5ab8
|