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
import os
from sklearn import datasets
from sklearn.preprocessing import MinMaxScaler
from sklearn.decomposition import PCA
from numpy.linalg import norm
def my_func(xs, ys, zs, *args, **kwargs):
fig, axes = subplots(1, 3, figsize=(9, 3))
X = MinMaxScaler().fit_transform(np.array([xs, ys, zs]).T)
distances = 1-norm(X-np.array([1,1,1]), axis=1, ord=2)
for axis in axes.flatten():
axis.scatter(*X.T, **kwargs, zorder=distances)
fig.tight_layout()
return fig
def test_rotate():
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, depthshade=False, 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.2.tar.gz
(4.9 kB
view details)
File details
Details for the file ddd_subplots-1.0.2.tar.gz
.
File metadata
- Download URL: ddd_subplots-1.0.2.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9bb47f29aa9ce2108e90eac7b2b57264034fe8f2482aa88c1e90fa771e9df55 |
|
MD5 | bb0fad04eb709f36388643b5a8b83b4e |
|
BLAKE2b-256 | 5177c7e34e42328797c16cf54fb0dcee64e581cb80d925a9a301628d79ccea06 |