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:

Back to top