Area Plot
Area and stacked-area plots from a pre-aggregated DataFrame.
No resampling or period aggregation is performed; feed pre-aggregated data. For time-based series that need resampling or period aggregation use plots.time.
plot(df, value_col, x_label=None, y_label=None, title=None, eyebrow=None, subtitle=None, x_col=None, group_col=None, ax=None, source_text=None, legend_title=None, move_legend_outside=False, legend_style=None, **kwargs)
Plot an area chart for value_col over x_col (or the index), optionally grouped.
A value_col list and a group_col are mutually exclusive; the legend is shown only for
multi-area charts, and alpha defaults to 0.7.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame or Series
|
Frame to plot; a Series is converted to a single-column frame. |
required |
value_col
|
str or list[str]
|
Column(s) to plot. |
required |
x_label
|
str
|
X-axis label; omitted means no label. |
None
|
y_label
|
str
|
Y-axis label; omitted means no label. |
None
|
title
|
str
|
Plot title. |
None
|
eyebrow
|
str
|
Uppercase label rendered above the title. |
None
|
subtitle
|
str
|
Supporting copy rendered below the title. |
None
|
x_col
|
str
|
Column used as the x-axis; if None, the index is used. |
None
|
group_col
|
str
|
Column used to split the data into separate areas. |
None
|
ax
|
Axes
|
Axes to plot on. |
None
|
source_text
|
str
|
Source attribution rendered at the bottom. |
None
|
legend_title
|
str
|
Legend title. |
None
|
move_legend_outside
|
bool
|
Move the legend outside the plot. |
False
|
legend_style
|
(box, end_of_line)
|
|
None
|
**kwargs
|
Any
|
Forwarded to pandas' plot. |
{}
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
ValueError
|
If |
Source code in openretailscience/plots/area.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | |