Skip to main content

lite version wrapper on plotly for quick utilization for scientific graphs

Project description

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plotly_lite-0.1.2.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

plotly_lite-0.1.2-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file plotly_lite-0.1.2.tar.gz.

File metadata

  • Download URL: plotly_lite-0.1.2.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for plotly_lite-0.1.2.tar.gz
Algorithm Hash digest
SHA256 cb98c7eb0821d8d2368fa366bd3c9a60fd041e0588c6cf08fd460313bfbd6f38
MD5 59067c61fdf8840166ab35da262ff8a9
BLAKE2b-256 665ec7f6ec13064928d9d496f18fae6de2885bffa1192eb0f25f5f7f38255637

See more details on using hashes here.

File details

Details for the file plotly_lite-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: plotly_lite-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for plotly_lite-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8aeabac746b100380a4f056a9aa68fc699c7c9b816cecabecfd9f29b9340ab02
MD5 00e3d95881cacf3a759ab28ec87d2bda
BLAKE2b-256 5bc915e88e1d8348c21d17086a9ea9c5757be57384c3aa49ae7f08a75c936a5f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page