Plotting
q.plot renders interactive Plotly figures for feature relationships, labels, multiclass model evaluation, return streams, and trade logs. q.plot.correlation creates a linked scatterplot matrix with categorical regime or continuous-outcome coloring, and q.plot.correlation_heatmap condenses a whole feature library into a clustered correlation matrix. q.plot.labels overlays long, hold, and short events on price, with optional outcome-interval shading; see the labeling examples. Classification diagnostics include one-vs-rest ROC and precision-recall curves with per-class, micro-average, and macro-average summaries. Return and trade visualizations cover quick column charts, equity curves, drawdowns, calendar heatmaps, full quantstats-style tearsheets, Monte Carlo diagnostics, entry/exit markers, excursions, and per-trade distributions. Return-stream statistics (performance, alpha/beta, rolling diagnostics, q.stats.montecarlo, …) live in q.stats; see Return Statistics. For market measurements, see Indicators.
For a quick ranked comparison of scalar strategy metrics, pass a Series:
q.plot.barchart(strategy_sharpes, sorted=True, title="Strategy Sharpe ratios")A DataFrame can select columns by name or wildcard. Multi-row frames require an explicit reduction so the chart never guesses what a “total” means:
q.plot.barchart(asset_returns, columns="*_return", aggregate="sum", sorted=True)Bars use green/red sign coloring by default. Set positive_color and negative_color, or pass color_scheme as one color, a color sequence, or a column-name-to-color mapping. Category labels are shown vertically by default.
Pages:
- Feature relationships — linked scatterplot matrices colored by market regime, asset, split, or continuous forward outcome.
- Correlation heatmap — whole-library correlation matrices with clustered ordering, rank methods, and triangle masking.
- Classification curves — multiclass ROC and precision-recall curves, plus reusable tidy curve data from
q.stats. - Ranked bar charts — strategy metrics, asset returns, DataFrame column selection, sorting, aggregation, and custom color schemes.
- Return charts — column charts, equity curves, drawdowns, full performance reports, and monthly heatmaps.
- Portfolio performance treemap — switch between accumulated held-period performance and point-in-time holdings with a shared date slider and optional exposure sizing.
- Tearsheet report — full quantstats-style strategy tearsheet (
q.plot.report) plus its individual panels (metrics table, cumulative returns, EOY returns, rolling diagnostics, worst drawdowns, …). - Probabilistic ratios — Sharpe and Sortino point estimates, PSR/PSoR sampling confidence, annualized thresholds, and standalone probability curves.
- Simulation tests — Monte Carlo fan charts and outcome distributions, variance testing, and noise testing.
- Trade logs — trade markers on price, MAE/MFE excursions, per-trade return distributions, and the trades → tearsheet bridge.
- Saving figures — exporting any figure to HTML/PNG.