xarray-plotly 0.0.7__tar.gz → 0.0.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {xarray_plotly-0.0.7 → xarray_plotly-0.0.9}/.github/workflows/docs.yml +0 -12
- {xarray_plotly-0.0.7 → xarray_plotly-0.0.9}/.github/workflows/release.yml +12 -0
- {xarray_plotly-0.0.7 → xarray_plotly-0.0.9}/PKG-INFO +1 -1
- xarray_plotly-0.0.9/docs/examples/fast_bar.ipynb +297 -0
- xarray_plotly-0.0.9/docs/examples/manipulation.ipynb +383 -0
- {xarray_plotly-0.0.7 → xarray_plotly-0.0.9}/mkdocs.yml +3 -0
- {xarray_plotly-0.0.7 → xarray_plotly-0.0.9}/tests/test_accessor.py +60 -0
- {xarray_plotly-0.0.7 → xarray_plotly-0.0.9}/xarray_plotly/accessor.py +73 -2
- {xarray_plotly-0.0.7 → xarray_plotly-0.0.9}/xarray_plotly/config.py +1 -0
- {xarray_plotly-0.0.7 → xarray_plotly-0.0.9}/xarray_plotly/figures.py +25 -9
- {xarray_plotly-0.0.7 → xarray_plotly-0.0.9}/xarray_plotly/plotting.py +165 -0
- {xarray_plotly-0.0.7 → xarray_plotly-0.0.9}/xarray_plotly.egg-info/PKG-INFO +1 -1
- {xarray_plotly-0.0.7 → xarray_plotly-0.0.9}/xarray_plotly.egg-info/SOURCES.txt +1 -0
- xarray_plotly-0.0.7/docs/examples/manipulation.ipynb +0 -708
- {xarray_plotly-0.0.7 → xarray_plotly-0.0.9}/.github/dependabot.yml +0 -0
- {xarray_plotly-0.0.7 → xarray_plotly-0.0.9}/.github/workflows/ci.yml +0 -0
- {xarray_plotly-0.0.7 → xarray_plotly-0.0.9}/.github/workflows/dependabot-auto-merge.yml +0 -0
- {xarray_plotly-0.0.7 → xarray_plotly-0.0.9}/.gitignore +0 -0
- {xarray_plotly-0.0.7 → xarray_plotly-0.0.9}/.pre-commit-config.yaml +0 -0
- {xarray_plotly-0.0.7 → xarray_plotly-0.0.9}/CONTRIBUTING.md +0 -0
- {xarray_plotly-0.0.7 → xarray_plotly-0.0.9}/LICENSE +0 -0
- {xarray_plotly-0.0.7 → xarray_plotly-0.0.9}/README.md +0 -0
- {xarray_plotly-0.0.7 → xarray_plotly-0.0.9}/docs/api.md +0 -0
- {xarray_plotly-0.0.7 → xarray_plotly-0.0.9}/docs/examples/combining.ipynb +0 -0
- {xarray_plotly-0.0.7 → xarray_plotly-0.0.9}/docs/examples/datasets.ipynb +0 -0
- {xarray_plotly-0.0.7 → xarray_plotly-0.0.9}/docs/examples/dimensions.ipynb +0 -0
- {xarray_plotly-0.0.7 → xarray_plotly-0.0.9}/docs/examples/figure.ipynb +0 -0
- {xarray_plotly-0.0.7 → xarray_plotly-0.0.9}/docs/examples/kwargs.ipynb +0 -0
- {xarray_plotly-0.0.7 → xarray_plotly-0.0.9}/docs/examples/plot-types.ipynb +0 -0
- {xarray_plotly-0.0.7 → xarray_plotly-0.0.9}/docs/getting-started.ipynb +0 -0
- {xarray_plotly-0.0.7 → xarray_plotly-0.0.9}/docs/index.md +0 -0
- {xarray_plotly-0.0.7 → xarray_plotly-0.0.9}/pyproject.toml +0 -0
- {xarray_plotly-0.0.7 → xarray_plotly-0.0.9}/setup.cfg +0 -0
- {xarray_plotly-0.0.7 → xarray_plotly-0.0.9}/tests/__init__.py +0 -0
- {xarray_plotly-0.0.7 → xarray_plotly-0.0.9}/tests/test_common.py +0 -0
- {xarray_plotly-0.0.7 → xarray_plotly-0.0.9}/tests/test_config.py +0 -0
- {xarray_plotly-0.0.7 → xarray_plotly-0.0.9}/tests/test_figures.py +0 -0
- {xarray_plotly-0.0.7 → xarray_plotly-0.0.9}/xarray_plotly/__init__.py +0 -0
- {xarray_plotly-0.0.7 → xarray_plotly-0.0.9}/xarray_plotly/common.py +0 -0
- {xarray_plotly-0.0.7 → xarray_plotly-0.0.9}/xarray_plotly/py.typed +0 -0
- {xarray_plotly-0.0.7 → xarray_plotly-0.0.9}/xarray_plotly.egg-info/dependency_links.txt +0 -0
- {xarray_plotly-0.0.7 → xarray_plotly-0.0.9}/xarray_plotly.egg-info/requires.txt +0 -0
- {xarray_plotly-0.0.7 → xarray_plotly-0.0.9}/xarray_plotly.egg-info/top_level.txt +0 -0
|
@@ -3,11 +3,6 @@ name: Docs
|
|
|
3
3
|
on:
|
|
4
4
|
pull_request:
|
|
5
5
|
branches: [main]
|
|
6
|
-
release:
|
|
7
|
-
types: [published]
|
|
8
|
-
|
|
9
|
-
permissions:
|
|
10
|
-
contents: write
|
|
11
6
|
|
|
12
7
|
jobs:
|
|
13
8
|
docs:
|
|
@@ -24,10 +19,3 @@ jobs:
|
|
|
24
19
|
|
|
25
20
|
- name: Build docs
|
|
26
21
|
run: uv run mkdocs build
|
|
27
|
-
|
|
28
|
-
- name: Deploy to GitHub Pages
|
|
29
|
-
if: github.event_name == 'release'
|
|
30
|
-
uses: peaceiris/actions-gh-pages@v4
|
|
31
|
-
with:
|
|
32
|
-
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
33
|
-
publish_dir: ./site
|
|
@@ -29,3 +29,15 @@ jobs:
|
|
|
29
29
|
with:
|
|
30
30
|
generate_release_notes: true
|
|
31
31
|
files: dist/*
|
|
32
|
+
|
|
33
|
+
- name: Install docs dependencies
|
|
34
|
+
run: uv sync --extra docs
|
|
35
|
+
|
|
36
|
+
- name: Build docs
|
|
37
|
+
run: uv run mkdocs build
|
|
38
|
+
|
|
39
|
+
- name: Deploy to GitHub Pages
|
|
40
|
+
uses: peaceiris/actions-gh-pages@v4
|
|
41
|
+
with:
|
|
42
|
+
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
43
|
+
publish_dir: ./site
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cells": [
|
|
3
|
+
{
|
|
4
|
+
"cell_type": "markdown",
|
|
5
|
+
"id": "0",
|
|
6
|
+
"metadata": {},
|
|
7
|
+
"source": [
|
|
8
|
+
"# Fast Bar Charts\n",
|
|
9
|
+
"\n",
|
|
10
|
+
"The `fast_bar()` method creates bar-like visualizations using stacked areas. This renders much faster than actual bar charts for large datasets because it uses a single polygon per trace instead of individual rectangles."
|
|
11
|
+
]
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"cell_type": "code",
|
|
15
|
+
"execution_count": null,
|
|
16
|
+
"id": "1",
|
|
17
|
+
"metadata": {},
|
|
18
|
+
"outputs": [],
|
|
19
|
+
"source": [
|
|
20
|
+
"import numpy as np\n",
|
|
21
|
+
"import xarray as xr\n",
|
|
22
|
+
"\n",
|
|
23
|
+
"from xarray_plotly import config, xpx\n",
|
|
24
|
+
"\n",
|
|
25
|
+
"config.notebook()"
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"cell_type": "markdown",
|
|
30
|
+
"id": "2",
|
|
31
|
+
"metadata": {},
|
|
32
|
+
"source": [
|
|
33
|
+
"## Basic Example"
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"cell_type": "code",
|
|
38
|
+
"execution_count": null,
|
|
39
|
+
"id": "3",
|
|
40
|
+
"metadata": {},
|
|
41
|
+
"outputs": [],
|
|
42
|
+
"source": [
|
|
43
|
+
"# Quarterly revenue data by product and region\n",
|
|
44
|
+
"np.random.seed(42)\n",
|
|
45
|
+
"da = xr.DataArray(\n",
|
|
46
|
+
" np.random.rand(4, 3, 2) * 100 + 50,\n",
|
|
47
|
+
" dims=[\"quarter\", \"product\", \"region\"],\n",
|
|
48
|
+
" coords={\n",
|
|
49
|
+
" \"quarter\": [\"Q1\", \"Q2\", \"Q3\", \"Q4\"],\n",
|
|
50
|
+
" \"product\": [\"Widgets\", \"Gadgets\", \"Gizmos\"],\n",
|
|
51
|
+
" \"region\": [\"North\", \"South\"],\n",
|
|
52
|
+
" },\n",
|
|
53
|
+
" name=\"revenue\",\n",
|
|
54
|
+
")\n",
|
|
55
|
+
"\n",
|
|
56
|
+
"xpx(da).fast_bar()"
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"cell_type": "code",
|
|
61
|
+
"execution_count": null,
|
|
62
|
+
"id": "4",
|
|
63
|
+
"metadata": {},
|
|
64
|
+
"outputs": [],
|
|
65
|
+
"source": [
|
|
66
|
+
"# Comparison with regular bar()\n",
|
|
67
|
+
"xpx(da).bar()"
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"cell_type": "markdown",
|
|
72
|
+
"id": "5",
|
|
73
|
+
"metadata": {},
|
|
74
|
+
"source": [
|
|
75
|
+
"## With Faceting"
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"cell_type": "code",
|
|
80
|
+
"execution_count": null,
|
|
81
|
+
"id": "6",
|
|
82
|
+
"metadata": {},
|
|
83
|
+
"outputs": [],
|
|
84
|
+
"source": [
|
|
85
|
+
"xpx(da).fast_bar(facet_col=\"region\")"
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"cell_type": "markdown",
|
|
90
|
+
"id": "7",
|
|
91
|
+
"metadata": {},
|
|
92
|
+
"source": [
|
|
93
|
+
"## With Animation"
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"cell_type": "code",
|
|
98
|
+
"execution_count": null,
|
|
99
|
+
"id": "8",
|
|
100
|
+
"metadata": {},
|
|
101
|
+
"outputs": [],
|
|
102
|
+
"source": [
|
|
103
|
+
"# Multi-year data for animation\n",
|
|
104
|
+
"np.random.seed(123)\n",
|
|
105
|
+
"da_anim = xr.DataArray(\n",
|
|
106
|
+
" np.random.rand(4, 3, 5) * 100 + 20,\n",
|
|
107
|
+
" dims=[\"quarter\", \"product\", \"year\"],\n",
|
|
108
|
+
" coords={\n",
|
|
109
|
+
" \"quarter\": [\"Q1\", \"Q2\", \"Q3\", \"Q4\"],\n",
|
|
110
|
+
" \"product\": [\"Widgets\", \"Gadgets\", \"Gizmos\"],\n",
|
|
111
|
+
" \"year\": [2020, 2021, 2022, 2023, 2024],\n",
|
|
112
|
+
" },\n",
|
|
113
|
+
" name=\"revenue\",\n",
|
|
114
|
+
")\n",
|
|
115
|
+
"\n",
|
|
116
|
+
"xpx(da_anim).fast_bar(animation_frame=\"year\")"
|
|
117
|
+
]
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"cell_type": "markdown",
|
|
121
|
+
"id": "9",
|
|
122
|
+
"metadata": {},
|
|
123
|
+
"source": [
|
|
124
|
+
"## Faceting + Animation"
|
|
125
|
+
]
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"cell_type": "code",
|
|
129
|
+
"execution_count": null,
|
|
130
|
+
"id": "10",
|
|
131
|
+
"metadata": {},
|
|
132
|
+
"outputs": [],
|
|
133
|
+
"source": [
|
|
134
|
+
"# 4D data: quarter x product x region x year\n",
|
|
135
|
+
"np.random.seed(456)\n",
|
|
136
|
+
"da_4d = xr.DataArray(\n",
|
|
137
|
+
" np.random.rand(4, 3, 2, 4) * 80 + 30,\n",
|
|
138
|
+
" dims=[\"quarter\", \"product\", \"region\", \"year\"],\n",
|
|
139
|
+
" coords={\n",
|
|
140
|
+
" \"quarter\": [\"Q1\", \"Q2\", \"Q3\", \"Q4\"],\n",
|
|
141
|
+
" \"product\": [\"Widgets\", \"Gadgets\", \"Gizmos\"],\n",
|
|
142
|
+
" \"region\": [\"North\", \"South\"],\n",
|
|
143
|
+
" \"year\": [2021, 2022, 2023, 2024],\n",
|
|
144
|
+
" },\n",
|
|
145
|
+
" name=\"revenue\",\n",
|
|
146
|
+
")\n",
|
|
147
|
+
"\n",
|
|
148
|
+
"xpx(da_4d).fast_bar(facet_col=\"region\", animation_frame=\"year\")"
|
|
149
|
+
]
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"cell_type": "markdown",
|
|
153
|
+
"id": "11",
|
|
154
|
+
"metadata": {},
|
|
155
|
+
"source": [
|
|
156
|
+
"## Positive and Negative Values\n",
|
|
157
|
+
"\n",
|
|
158
|
+
"`fast_bar()` classifies each trace by its values:\n",
|
|
159
|
+
"- **Purely positive** → stacks upward\n",
|
|
160
|
+
"- **Purely negative** → stacks downward\n",
|
|
161
|
+
"- **Mixed signs** → warning + dashed line (use `bar()` instead)"
|
|
162
|
+
]
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"cell_type": "code",
|
|
166
|
+
"execution_count": null,
|
|
167
|
+
"id": "12",
|
|
168
|
+
"metadata": {},
|
|
169
|
+
"outputs": [],
|
|
170
|
+
"source": [
|
|
171
|
+
"# Profit (positive) and Loss (negative) - stacks correctly\n",
|
|
172
|
+
"np.random.seed(789)\n",
|
|
173
|
+
"da_split = xr.DataArray(\n",
|
|
174
|
+
" np.column_stack(\n",
|
|
175
|
+
" [\n",
|
|
176
|
+
" np.random.rand(6) * 80 + 20, # Revenue: positive\n",
|
|
177
|
+
" -np.random.rand(6) * 50 - 10, # Costs: negative\n",
|
|
178
|
+
" ]\n",
|
|
179
|
+
" ),\n",
|
|
180
|
+
" dims=[\"month\", \"category\"],\n",
|
|
181
|
+
" coords={\n",
|
|
182
|
+
" \"month\": [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\"],\n",
|
|
183
|
+
" \"category\": [\"Revenue\", \"Costs\"],\n",
|
|
184
|
+
" },\n",
|
|
185
|
+
" name=\"financials\",\n",
|
|
186
|
+
")\n",
|
|
187
|
+
"\n",
|
|
188
|
+
"xpx(da_split).fast_bar()"
|
|
189
|
+
]
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"cell_type": "code",
|
|
193
|
+
"execution_count": null,
|
|
194
|
+
"id": "13",
|
|
195
|
+
"metadata": {},
|
|
196
|
+
"outputs": [],
|
|
197
|
+
"source": [
|
|
198
|
+
"# With animation - sign classification is consistent across frames\n",
|
|
199
|
+
"np.random.seed(321)\n",
|
|
200
|
+
"da_split_anim = xr.DataArray(\n",
|
|
201
|
+
" np.stack(\n",
|
|
202
|
+
" [\n",
|
|
203
|
+
" np.column_stack([np.random.rand(6) * 80 + 20, -np.random.rand(6) * 50 - 10])\n",
|
|
204
|
+
" for _ in range(4)\n",
|
|
205
|
+
" ],\n",
|
|
206
|
+
" axis=-1,\n",
|
|
207
|
+
" ),\n",
|
|
208
|
+
" dims=[\"month\", \"category\", \"year\"],\n",
|
|
209
|
+
" coords={\n",
|
|
210
|
+
" \"month\": [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\"],\n",
|
|
211
|
+
" \"category\": [\"Revenue\", \"Costs\"],\n",
|
|
212
|
+
" \"year\": [2021, 2022, 2023, 2024],\n",
|
|
213
|
+
" },\n",
|
|
214
|
+
" name=\"financials\",\n",
|
|
215
|
+
")\n",
|
|
216
|
+
"\n",
|
|
217
|
+
"xpx(da_split_anim).fast_bar(animation_frame=\"year\")"
|
|
218
|
+
]
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"cell_type": "markdown",
|
|
222
|
+
"id": "14",
|
|
223
|
+
"metadata": {},
|
|
224
|
+
"source": [
|
|
225
|
+
"## Mixed Sign Warning\n",
|
|
226
|
+
"\n",
|
|
227
|
+
"When a trace has both positive and negative values, `fast_bar()` shows a warning and displays it as a dashed line:"
|
|
228
|
+
]
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"cell_type": "code",
|
|
232
|
+
"execution_count": null,
|
|
233
|
+
"id": "15",
|
|
234
|
+
"metadata": {},
|
|
235
|
+
"outputs": [],
|
|
236
|
+
"source": [
|
|
237
|
+
"# Both columns have mixed signs - triggers warning\n",
|
|
238
|
+
"da_mixed = xr.DataArray(\n",
|
|
239
|
+
" np.array(\n",
|
|
240
|
+
" [\n",
|
|
241
|
+
" [50, -30],\n",
|
|
242
|
+
" [-40, 60],\n",
|
|
243
|
+
" [30, -50],\n",
|
|
244
|
+
" [-20, 40],\n",
|
|
245
|
+
" ]\n",
|
|
246
|
+
" ),\n",
|
|
247
|
+
" dims=[\"month\", \"category\"],\n",
|
|
248
|
+
" coords={\n",
|
|
249
|
+
" \"month\": [\"Jan\", \"Feb\", \"Mar\", \"Apr\"],\n",
|
|
250
|
+
" \"category\": [\"A\", \"B\"],\n",
|
|
251
|
+
" },\n",
|
|
252
|
+
")\n",
|
|
253
|
+
"\n",
|
|
254
|
+
"# This will show a warning\n",
|
|
255
|
+
"xpx(da_mixed).fast_bar()"
|
|
256
|
+
]
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
"cell_type": "code",
|
|
260
|
+
"execution_count": null,
|
|
261
|
+
"id": "16",
|
|
262
|
+
"metadata": {},
|
|
263
|
+
"outputs": [],
|
|
264
|
+
"source": [
|
|
265
|
+
"# For mixed data, use bar() instead\n",
|
|
266
|
+
"xpx(da_mixed).bar()"
|
|
267
|
+
]
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
"cell_type": "markdown",
|
|
271
|
+
"id": "17",
|
|
272
|
+
"metadata": {},
|
|
273
|
+
"source": [
|
|
274
|
+
"## When to Use\n",
|
|
275
|
+
"\n",
|
|
276
|
+
"| Method | Use when... |\n",
|
|
277
|
+
"|--------|-------------|\n",
|
|
278
|
+
"| `fast_bar()` | Large datasets, animations, performance matters, data is same-sign per trace |\n",
|
|
279
|
+
"| `bar()` | Need grouped bars, pattern fills, or have mixed +/- values per trace |\n",
|
|
280
|
+
"| `area()` | Want smooth continuous fills |"
|
|
281
|
+
]
|
|
282
|
+
}
|
|
283
|
+
],
|
|
284
|
+
"metadata": {
|
|
285
|
+
"kernelspec": {
|
|
286
|
+
"display_name": "Python 3",
|
|
287
|
+
"language": "python",
|
|
288
|
+
"name": "python3"
|
|
289
|
+
},
|
|
290
|
+
"language_info": {
|
|
291
|
+
"name": "python",
|
|
292
|
+
"version": "3.12.0"
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
"nbformat": 4,
|
|
296
|
+
"nbformat_minor": 5
|
|
297
|
+
}
|