finance plots
Matplotlib plots and performance tables for financial return series, price paths, and technical-indicator panels.
Overview
finance-plots is the presentation layer for the finance stack. It accepts
Narwhals-compatible inputs such as pandas, Polars, numpy, and other supported
series-like objects, then returns ordinary matplotlib figures or Great Tables
objects that can be saved, embedded in notebooks, or composed into tearsheets.
The initial release focuses on a compact, useful surface:
- Return/risk plots for cumulative returns, rolling volatility, rolling Sharpe, rolling beta/correlation, benchmark scatter, drawdowns, and period-return views.
- Technical-indicator plots for price overlays, secondary-axis indicators, and indicator sub-panels.
- Performance summary tables backed by
great-tables. - Post-trade diagnostics for trading-cost breakdowns, MAE/MFE scatter, and execution-quality distributions.
- Alpha-analysis plots for IC, quantile returns, turnover, and cumulative factor returns.
Install
pip install finance-plots
The gallery and documentation examples use the released data/calculation stack:
pip install "finance-plots[examples]"
Quick Start
Generate deterministic prices with finance-datagen, compute returns with
finance-calcs, and plot them with finance-plots.
from datetime import datetime, timezone
import polars as pl
from finance_datagen import generate_prices
import finance_calcs as fc
import finance_plots as fp
start_ms = int(datetime(2021, 1, 4, tzinfo=timezone.utc).timestamp() * 1000)
prices = generate_prices(symbol="ACME", seed=7, start_ms=start_ms)
returns = prices.with_columns(
fc.simple_returns(pl.col("price")).alias("ret"),
).select("ret").drop_nulls()["ret"]
fig = fp.plot_rolling_returns(returns)
Current Plot Catalog
| Function | Use it for |
|---|---|
plot_returns(returns) |
Simple cumulative return path |
plot_rolling_returns(returns, benchmark=None, live_start=None) |
Cumulative return path with optional benchmark and out-of-sample shading |
plot_rolling_volatility(returns, window=63) |
Rolling annualized volatility |
plot_rolling_sharpe(returns, window=63) |
Rolling annualized Sharpe ratio |
plot_rolling_beta(returns, benchmark, window=63) |
Rolling beta versus a benchmark |
plot_rolling_correlation(returns, benchmark, window=63) |
Rolling correlation versus a benchmark |
plot_return_scatter(returns, benchmark) |
Strategy returns against benchmark returns with a fitted beta line |
plot_drawdown_underwater(returns) |
Filled underwater drawdown chart |
plot_returns_heatmap(returns, period="month") |
Year-by-month, year-by-quarter, or year-by-week return heatmap |
plot_returns_bar(returns, period="year") |
Compounded period returns as a bar chart |
plot_returns_dist(returns, period="month") |
Distribution of compounded period returns |
plot_returns_timeseries(returns, period="month") |
Compounded period returns through time |
plot_price_with_overlays(price, overlays, secondary_overlays) |
Price line with moving averages and secondary-axis indicators |
plot_indicator_panel(price, panels) |
Price chart with one or more aligned indicator sub-panels |
plot_trading_cost_breakdown_bar(costs) |
Trading cost attribution by component |
plot_mfe_mae_scatter(trades) |
Maximum adverse versus favorable excursion by trade |
plot_execution_quality(executions) |
Implementation-shortfall distribution |
plot_ic_ts(ic) |
Information-coefficient time series with rolling mean |
plot_ic_hist(ic) |
Information-coefficient distribution |
plot_ic_qq(ic) |
Information-coefficient Q-Q plot |
plot_ic_by_group(data) |
Mean IC by sector/group |
plot_ic_heatmap(ic) |
Calendar heatmap of mean IC |
plot_rolling_ic(ic) |
Rolling mean IC |
plot_quantile_returns_bar(data) |
Mean return by signal quantile |
plot_top_bottom_quantile_turnover(data) |
Top/bottom quantile turnover |
plot_cumulative_factor_returns(factor_returns) |
Compounded long-short factor return path |
Current Table Catalog
| Function | Use it for |
|---|---|
performance_statistics(returns) |
Dictionary of cumulative return, annualized return/volatility, Sharpe, Sortino, max drawdown, and Calmar |
table_performance_statistics(returns, benchmark=None) |
Great Tables performance summary with optional benchmark column |
table_period_returns(returns, period="year") |
Great Tables period-return summary |
table_drawdowns(returns, top=5) |
Great Tables largest-drawdown-period summary |
table_cost_breakdown(costs) |
Great Tables trading-cost attribution summary |
table_round_trip_stats(trades) |
Great Tables round-trip trade-quality summary |
table_execution_quality(executions) |
Great Tables implementation-shortfall summary |
table_information(ic) |
Great Tables information-coefficient summary |
table_returns_by_quantile(data) |
Great Tables mean return by quantile |
table_turnover(data) |
Great Tables quantile-turnover summary |
table_quantile_statistics(data) |
Great Tables quantile counts and signal statistics |
Metadata
Release files for finance-plots 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 | Actions |
|---|---|---|---|---|
| finance_plots-0.2.0.tar.gz | 31.7 kB | Without provenance | Details for finance_plots-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| finance_plots-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for finance_plots-0.2.0-py3-none-any.whl |
Total release size: 71.0 kB
Release files / finance_plots-0.2.0.tar.gz
| Download URL | finance_plots-0.2.0.tar.gz |
|---|---|
| Size | 31.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e4ade180df1ab46ece08806a2e9ce201c5ec056aa8f56a3d6934f286fa060af5
|
|
BLAKE2b-256 checksum How to use checksums |
35cd932fbb1e01b2712c04b05d9360f349e3dff88913cd27509f290b6c145956
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Release files / finance_plots-0.2.0-py3-none-any.whl
| Download URL | finance_plots-0.2.0-py3-none-any.whl |
|---|---|
| Size | 39.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f5dde860c19c16f8f1dc94a303f3a7adde4f72536ca4384c65d1d93dae4977b3
|
|
BLAKE2b-256 checksum How to use checksums |
fdf1f2f950565e0d45492997030cbb19811cc9b57869b2608f9ab071e8e28492
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Security for finance-plots 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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.