Skip to main content

Helper for spider/radar plot visualization

Project description

Spiderplotlib

Simple spider/radar plots for Python with matplotlib.

Installation (using PyPI)

pip install spiderplotlib

Development (using uv)

git clone https://github.com/gabriel-jung/spiderplotlib
cd spiderplotlib
uv sync

Quick Start

import matplotlib.pyplot as plt
from spiderplotlib import spider_plot

# Algorithm performance
groups = [
    [0.89, 0.92, 0.78, 0.95, 0.88],
    [0.85, 0.88, 0.90, 0.82, 0.91],
]

labels = ['Precision', 'Recall', 'Speed', 'Memory', 'F1']

fig = spider_plot(
    groups=groups,
    labels=labels,
    title='Algorithm Comparison',
    group_names=['RF', 'XGBoost']
)

plt.show()

API Reference

spider_plot()

spider_plot(
    groups: List[Union[List[float], np.ndarray]],
    labels: List[str],
    group_names: Optional[List[str]] = None,
    group_colors: Optional[List[str]] = None,
    title: Optional[str] = None,
    show_legend: bool = True,
    show_values: bool = False,
    show_scale: bool = True,
    figsize: tuple = (8, 8),
    alpha: float = 0.3,
    grid_levels: Optional[List[float]] = None,
    value_format: str = "{:.2f}",
    label_distance: float = 1.2,
) -> mpl.figure.Figure

Parameters:

  • groups: List of groups to compare (each contains values for all axes)
  • labels: List of strings representing axis/parameter labels.
  • group_names: Optional list of labels for each group (displayed in legend).
  • group_colors: Optional list of colors for each group.
  • title: Optional plot title string.
  • show_legend: Whether to display legend (default: True).
  • show_values: Whether to display maximum values on each axis (default: False).
  • show_scale: Whether to display percentage scale indicators (default: True).
  • figsize: Figure size as (width, height) tuple (default: (8, 8)).
  • alpha: Transparency for filled areas, range 0-1 (default: 0.3).
  • grid_levels: Custom grid levels as fractions (default: [0.2, 0.4, 0.6, 0.8, 1.0]).
  • value_format: Format string for displayed values (default: "{:.2f}").
  • label_distance: Distance of labels from center (default: 1.2).

Returns:

  • matplotlib.figure.Figure: The created figure object.

Advanced Usage

Custom Colors

fig = spider_plot(
    groups=groups,
    labels=labels,
    group_colors=['#1f77b4', '#ff7f0e'],
    alpha=0.4
)

Adjust label distance

fig = spider_plot(
    groups=groups,
    labels=long_labels,
    label_distance=1.4  # Move labels further out
)

Examples

See example.py for complete working examples and example.ipynb for comprehensive exploration of features.

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

spiderplotlib-0.1.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

spiderplotlib-0.1.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file spiderplotlib-0.1.0.tar.gz.

File metadata

  • Download URL: spiderplotlib-0.1.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for spiderplotlib-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2df6b5c0457084681d25f22a05045ecf38e9105b5e98d9afc177fd715b6af160
MD5 6c0eced90404bf20fdecdd6849c8e8f1
BLAKE2b-256 a038bb34d0530ddfc586c72b47925fd01f7df2efd4f896a5fc2aa6b187e4885b

See more details on using hashes here.

File details

Details for the file spiderplotlib-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: spiderplotlib-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for spiderplotlib-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 94085298c812b1c111a686814f9105342dc3a6b9079baf136d2f7924d4dcf63a
MD5 895dbfd0291b9af72b557a245a4e3f2e
BLAKE2b-256 56678dd8186cbe7ffe6adc21f9f65b908878eb8ac21fe9f66d682255a583340b

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