import expdpy as ex
from expdpy.data import load_kuznets, load_kuznets_data_def
df = ex.set_labels(load_kuznets(), load_kuznets_data_def(), set_panel=True)
ex.explore_quantile_trend_plot(df, var="log_gdp_pc").figexplore_quantile_trend_plot
explore_quantile_trend_plot(
df,
quantiles=(0.05, 0.25, 0.5, 0.75, 0.95),
var=None,
*,
time=None,
points=True,
title=None,
subtitle=None,
)Line-plot quantiles of a single variable over time.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| df | pd.DataFrame | Data frame containing time and the variable to plot. |
required |
| quantiles | Sequence[float] | Quantile levels to plot (each in (0, 1)). |
(0.05, 0.25, 0.5, 0.75, 0.95) |
| var | str | None | Variable to plot. Defaults to the last numeric column that is not time. |
None |
| time | str | None | Column name of the time identifier. Defaults to the panel time declared via :func:expdpy.set_panel. |
None |
| points | bool | Whether to mark each observation with a point. | True |
Returns
| Name | Type | Description |
|---|---|---|
| QuantileTrendGraphResult | df (long format: time, quantile, value) and the Plotly fig. |
Examples
Basic — the default quantiles of a variable over time:
Advanced — custom quantile levels and no per-observation points:
import expdpy as ex
from expdpy.data import load_kuznets, load_kuznets_data_def
df = ex.set_labels(load_kuznets(), load_kuznets_data_def(), set_panel=True)
ex.explore_quantile_trend_plot(
df, quantiles=(0.1, 0.5, 0.9), var="log_gdp_pc", points=False
).fig