Skip to main content

plotting.py

A lightweight Plotly wrapper for fast prototyping of common scientific and ML charts — minimal boilerplate, consistent styling out of the box.

Installation

pip install plotly kaleido scikit-learn matplotlib numpy

Usage

from plotting import plotBox, plotCompare, plotHeatmap  # etc.

Every function accepts a title, x_label / y_label, an optional size=(height, width) tuple, and two output modes:

Param Default Effect
html=False False Save a self-contained .html file instead of displaying inline
export=None None Save a static image — 'png', 'svg', 'pdf', …

Functions

plotBox — grouped box plots

plotBox(
    {'Model A': array_a, 'Model B': array_b},
    title='Accuracy by Model',
    y_label='Accuracy',
    ylimit=[0.5, 1.0],
)

plotCompare — line chart with shared x axis

Best for training curves, time series, anything where all series share the same x values.

epochs = np.arange(1, 51)
plotCompare(
    epochs,
    {'Train': train_loss, 'Val': val_loss},
    title='Loss Curves',
    x_label='Epoch', y_label='Loss',
)

plotCombine — multi-series with independent x arrays

Use when each series has its own x domain or resolution.

plotCombine(
    {'sin': (t, np.sin(t)), 'cos': (t, np.cos(t))},
    title='Trig Functions',
    mode='lines',  # 'markers' or 'lines+markers' also accepted
)

plotScatter — scatter plot, shared x

plotScatter(
    x_vals,
    {'Group A': y_a, 'Group B': y_b},
    title='Feature vs Target',
    dot_size=4,
)

plotMap — raw heatmap (no interpolation)

Good for confusion matrices, correlation grids, any discrete 2-D matrix.

plotMap(z=matrix, x=col_labels, y=row_labels, title='Confusion Matrix')

plotHeatmap — contour plot with heatmap fill

For continuous surfaces where you want to highlight level sets.

plotHeatmap(z=Z, x=grid_x, y=grid_y, title='Loss Surface', ncontours=15)

plotTrajectory — 2-D paths with time-varying marker size

Markers grow over time so you can track direction at a glance.

plotTrajectory(
    evo=np.arange(T),           # drives marker size (normalised to [0, 15])
    plot={'Agent': path},       # path is an (N, 2) array
    title='Agent Trajectory',
)

plotOptimization — loss landscape + optimiser paths

Overlays one or more optimiser trajectories on a filled contour map.

plotOptimization(
    z=loss_surface, x=w1, y=w2,
    paths={'SGD': sgd_path, 'Adam': adam_path},
    title='Optimiser Comparison',
)

viewPCA — 2-D PCA projection (matplotlib)

Reduces high-dimensional data to 2 components and colours points by a given index.

viewPCA(X, index=labels, title='PCA Projection', x='PC 1', y='PC 2')

Exporting

# Save a PNG (written twice to avoid kaleido race condition)
plotCompare(epochs, data, title='loss', export='png')

# Save an interactive HTML file
plotCompare(epochs, data, title='loss', html=True)

Metadata

Release files for plotly-lite 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for plotly-lite 0.1.2
File Size Uploaded
plotly_lite-0.1.2.tar.gz 11.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for plotly-lite 0.1.2
File Interpreter ABI Platform
plotly_lite-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 26.9 kB

Release files / plotly_lite-0.1.2.tar.gz

Download URL plotly_lite-0.1.2.tar.gz
Size 11.9 kB
Tags Source
SHA-256 checksum
How to use checksums
cb98c7eb0821d8d2368fa366bd3c9a60fd041e0588c6cf08fd460313bfbd6f38
BLAKE2b-256 checksum
How to use checksums
665ec7f6ec13064928d9d496f18fae6de2885bffa1192eb0f25f5f7f38255637
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

Release files / plotly_lite-0.1.2-py3-none-any.whl

Download URL plotly_lite-0.1.2-py3-none-any.whl
Size 14.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8aeabac746b100380a4f056a9aa68fc699c7c9b816cecabecfd9f29b9340ab02
BLAKE2b-256 checksum
How to use checksums
5bc915e88e1d8348c21d17086a9ea9c5757be57384c3aa49ae7f08a75c936a5f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page