gg-diagram
Publication-quality GG diagrams for vehicle dynamics analysis.
Plot lateral vs longitudinal acceleration as distance-weighted heatmaps. Based on the GG diagram concept from Milliken & Milliken's Race Car Vehicle Dynamics (1995).
Real driving data (AEGIS dataset, 81 km, Graz, Austria). Left: raw IMU signal with gravity bias. Right: after in-field calibration -- the acceleration cloud is centered and aligned with the vehicle axes.
Installation
pip install gg-diagram
Quick Start
import pandas as pd
from gg_diagram import gg_heatmap
df = pd.read_parquet("my_driving_data.parquet")
fig = gg_heatmap(df, ax_col="ax_mps2", ay_col="ay_mps2", speed_col="speed_mps")
fig.show()
Features
- Distance-weighted heatmap -- bins weighted by
speed * dt, not sample count - Log scale -- reveals both high-density core and low-density tails
- Publication style -- directional axis labels (Braking/Acceleration, Right/Left Turn), external contour, automotive colorscale
- Before/After comparison --
gg_compare()with shared color axis - Two modes --
mode="interactive"(rich hover) ormode="paper"(compact for export) - Auto unit detection -- accepts m/s2, g, or mG
- Variable frequency -- computes dt from timestamps (handles multi-rate datasets)
API
gg_heatmap(df, ...)
Single GG diagram.
fig = gg_heatmap(
df,
ax_col="ax_mps2", # longitudinal acceleration column
ay_col="ay_mps2", # lateral acceleration column
speed_col="speed_mps", # speed in m/s (for distance weighting)
ts_col="ts", # timestamp column (for variable dt)
hz=10.0, # fallback frequency if no timestamps
title="My GG Diagram",
mode="interactive", # or "paper"
output_html="gg.html", # optional HTML export
)
gg_compare(df_before, df_after, ...)
Side-by-side comparison with shared color scale.
fig = gg_compare(
df_before, df_after,
title_before="Raw",
title_after="Calibrated",
main_title="IMU Rectification",
mode="paper",
output_html="compare.html",
)
gg_scatter(df, ...)
Scatter plot with optional speed coloring.
fig = gg_scatter(df, color_col="speed_mps")
Metrics
Each figure exposes severity metrics via fig._gg_meta:
fig._gg_meta["std_gx"] # Std of longitudinal acceleration (g)
fig._gg_meta["std_gy"] # Std of lateral acceleration (g)
fig._gg_meta["total_distance_km"] # Total distance (km)
Data Format
The package expects a pandas DataFrame with at minimum:
| Column | Unit | Description |
|---|---|---|
ax_mps2 |
m/s2 | Longitudinal acceleration |
ay_mps2 |
m/s2 | Lateral acceleration |
speed_mps |
m/s | Vehicle speed (for distance weighting) |
ts |
datetime | Timestamp (optional, for variable-rate data) |
Column names are configurable via ax_col, ay_col, speed_col, ts_col.
Links
- Research: research.roadsimulator3.fr
- Simulator: simulate.roadsimulator3.fr
- Author: Sebastien Edet
License
MIT
Metadata
Release files for gg-diagram 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| gg_diagram-0.2.0.tar.gz | 12.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gg_diagram-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.2 kB
Release files / gg_diagram-0.2.0.tar.gz
| Download URL | gg_diagram-0.2.0.tar.gz |
|---|---|
| Size | 12.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c03242b32ca552f72eaff01c05619b1ee96b379f06357a229c02448e3cc8444d
|
|
BLAKE2b-256 checksum How to use checksums |
95243dd259b8be72a50c9cbb01e40e151e7f6ef17590665791f51803db031705
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.2
|
Release files / gg_diagram-0.2.0-py3-none-any.whl
| Download URL | gg_diagram-0.2.0-py3-none-any.whl |
|---|---|
| Size | 12.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8655bca75d1dbf24afeda696e5fbfe3f4efbb24e79372a28c54d1000797fdd04
|
|
BLAKE2b-256 checksum How to use checksums |
79cfe998a12bac5dbf8a597d2f330afea2073ec3e89662f511b999c6506ae0fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.2
|
Security for gg-diagram 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.