Welcome
Welcome to the Plotynium framework documentation.
What is Plotynium ?
Plotynium is a Data Visualization framework for Python, inspired by Observable Plot.
-
Easy to use
Implements concise code to explore your data
-
Low dependencies
plotynium
requires onlydetroit
(<3MB) andlxml
(<12MB) dependencies. -
Open Source
plotynium
is licensed under MIT.
Example
import polars as pl
from sklearn.datasets import load_digits
from sklearn.decomposition import PCA
from sklearn.preprocessing import StandardScaler
import plotynium as ply
mnist = load_digits()
scaler = StandardScaler()
X_scaled = scaler.fit_transform(mnist.data)
pca = PCA(n_components=2)
components = pca.fit_transform(X_scaled)
# Prepare your data with Polars, Pandas or manually
df = pl.DataFrame(components, schema=["Component 1", "Component 2"])
df = df.insert_column(2, pl.Series("digit", mnist.target))
plot = ply.plot(
width=960,
height=657,
marks=[
ply.dot(
df.to_dicts(),
x="Component 1",
y="Component 2",
stroke="digit", # (1)!
symbol="digit", # (2)!
)
],
color={"scheme": ply.Interpolation.RAINBOW}, # (3)!
symbol={"legend": True}, # (4)!
style={"color": "#e6edf3"}, # (5)!
)
with open("pca.svg", "w") as file:
file.write(str(plot))
- Colors of points are chosen given its
digit
value - Symbols of points are chosen given its
digit
value - Check out the colorscheme section to see all available colorschemes.
- It adds a legend of symbols (color included).
- Style your plot as you want. Checkout
StyleOptions
for more option details.