Skip to content

Commit 0766a08

Browse files
committed
Rename package and accessor.py
1 parent 2f0a01b commit 0766a08

10 files changed

Lines changed: 7073 additions & 123 deletions

File tree

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
# xarray-plotly
1+
# xarray_plotly
22

33
**Interactive Plotly Express plotting accessor for xarray**
44

5-
[![PyPI version](https://badge.fury.io/py/xarray-plotly.svg)](https://badge.fury.io/py/xarray-plotly)
6-
[![Python](https://img.shields.io/pypi/pyversions/xarray-plotly.svg)](https://pypi.org/project/xarray-plotly/)
5+
[![PyPI version](https://badge.fury.io/py/xarray_plotly.svg)](https://badge.fury.io/py/xarray_plotly)
6+
[![Python](https://img.shields.io/pypi/pyversions/xarray_plotly.svg)](https://pypi.org/project/xarray_plotly/)
77

8-
xarray-plotly provides a `pxplot` accessor for xarray DataArray objects that enables interactive plotting using Plotly Express with automatic dimension-to-slot assignment.
8+
xarray_plotly provides a `plotly` accessor for xarray DataArray objects that enables interactive plotting using Plotly Express with automatic dimension-to-slot assignment.
99

1010
## Installation
1111

1212
```bash
13-
pip install xarray-plotly
13+
pip install xarray_plotly
1414
```
1515

1616
Or with uv:
1717

1818
```bash
19-
uv add xarray-plotly
19+
uv add xarray_plotly
2020
```
2121

2222
## Quick Start
@@ -40,7 +40,7 @@ da = xr.DataArray(
4040

4141
# Create an interactive line plot
4242
# Dimensions auto-assign: time→x, city→color, scenario→facet_col
43-
fig = da.pxplot.line()
43+
fig = da.plotly.line()
4444
fig.show()
4545

4646
# Easy customization
@@ -62,13 +62,13 @@ Dimensions are automatically assigned to plot "slots" based on their order:
6262
```python
6363
# dims: (time, city, scenario)
6464
# auto-assigns: time→x, city→color, scenario→facet_col
65-
da.pxplot.line()
65+
da.plotly.line()
6666

6767
# Override with explicit assignments
68-
da.pxplot.line(x="time", color="scenario", facet_col="city")
68+
da.plotly.line(x="time", color="scenario", facet_col="city")
6969

7070
# Skip a slot with None
71-
da.pxplot.line(color=None) # time→x, city→facet_col
71+
da.plotly.line(color=None) # time→x, city→facet_col
7272
```
7373

7474
## Available Methods
@@ -84,7 +84,7 @@ da.pxplot.line(color=None) # time→x, city→facet_col
8484

8585
## Documentation
8686

87-
Full documentation with examples: [https://felix.github.io/xarray-plotly](https://felix.github.io/xarray-plotly)
87+
Full documentation with examples: [https://felix.github.io/xarray_plotly](https://felix.github.io/xarray_plotly)
8888

8989
## License
9090

docs/examples/advanced.ipynb

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"source": [
2929
"## Working with xarray Attributes\n",
3030
"\n",
31-
"xarray-plotly automatically uses metadata from xarray attributes for labels:"
31+
"xarray_plotly automatically uses metadata from xarray attributes for labels:"
3232
]
3333
},
3434
{
@@ -57,7 +57,7 @@
5757
"da.coords[\"station\"].attrs = {\"long_name\": \"Measurement Station\"}\n",
5858
"\n",
5959
"# Labels are automatically extracted from attrs\n",
60-
"fig = da.pxplot.line(title=\"Temperature with Auto-Labels\")\n",
60+
"fig = da.plotly.line(title=\"Temperature with Auto-Labels\")\n",
6161
"fig"
6262
]
6363
},
@@ -76,7 +76,7 @@
7676
"metadata": {},
7777
"outputs": [],
7878
"source": [
79-
"fig = da.pxplot.line(\n",
79+
"fig = da.plotly.line(\n",
8080
" labels={\n",
8181
" \"temperature\": \"Temp (°C)\",\n",
8282
" \"time\": \"Date\",\n",
@@ -117,7 +117,7 @@
117117
")\n",
118118
"\n",
119119
"# Use line_dash for one dimension, color for another\n",
120-
"fig = da_complex.sel(city=\"NYC\").pxplot.line(\n",
120+
"fig = da_complex.sel(city=\"NYC\").plotly.line(\n",
121121
" color=\"scenario\",\n",
122122
" line_dash=\"model\",\n",
123123
" title=\"Multiple Visual Encodings\",\n",
@@ -141,7 +141,7 @@
141141
"outputs": [],
142142
"source": [
143143
"# Average over model dimension\n",
144-
"fig = da_complex.mean(\"model\").pxplot.line(\n",
144+
"fig = da_complex.mean(\"model\").plotly.line(\n",
145145
" facet_col=\"city\",\n",
146146
" title=\"Ensemble Mean by City\",\n",
147147
")\n",
@@ -155,7 +155,7 @@
155155
"outputs": [],
156156
"source": [
157157
"# Select a specific slice\n",
158-
"fig = da_complex.sel(scenario=\"SSP5\", model=\"GCM-A\").pxplot.line(\n",
158+
"fig = da_complex.sel(scenario=\"SSP5\", model=\"GCM-A\").plotly.line(\n",
159159
" facet_col=\"city\",\n",
160160
" title=\"SSP5 / GCM-A Projections\",\n",
161161
")\n",
@@ -184,7 +184,7 @@
184184
"source": [
185185
"da_simple = da.sel(station=\"Urban\")\n",
186186
"\n",
187-
"fig = da_simple.pxplot.line(\n",
187+
"fig = da_simple.plotly.line(\n",
188188
" template=\"plotly_dark\",\n",
189189
" title=\"Dark Theme\",\n",
190190
")\n",
@@ -206,7 +206,7 @@
206206
"source": [
207207
"import plotly.express as px\n",
208208
"\n",
209-
"fig = da.pxplot.line(\n",
209+
"fig = da.plotly.line(\n",
210210
" color_discrete_sequence=px.colors.qualitative.Set2,\n",
211211
" title=\"Custom Color Palette\",\n",
212212
")\n",
@@ -233,7 +233,7 @@
233233
")\n",
234234
"\n",
235235
"# Diverging colorscale centered at zero\n",
236-
"fig = da_2d.pxplot.imshow(\n",
236+
"fig = da_2d.plotly.imshow(\n",
237237
" color_continuous_scale=\"RdBu_r\",\n",
238238
" color_continuous_midpoint=0,\n",
239239
" title=\"Diverging Colorscale\",\n",
@@ -256,7 +256,7 @@
256256
"metadata": {},
257257
"outputs": [],
258258
"source": [
259-
"fig = da.pxplot.line()\n",
259+
"fig = da.plotly.line()\n",
260260
"\n",
261261
"# Add horizontal reference line\n",
262262
"fig.add_hline(y=15, line_dash=\"dash\", line_color=\"gray\", annotation_text=\"Reference\")\n",
@@ -289,7 +289,7 @@
289289
"metadata": {},
290290
"outputs": [],
291291
"source": [
292-
"fig = da.pxplot.line()\n",
292+
"fig = da.plotly.line()\n",
293293
"\n",
294294
"# Make all lines thicker\n",
295295
"fig.update_traces(line_width=3)\n",
@@ -349,7 +349,7 @@
349349
"# Rolling mean\n",
350350
"da_smooth = da.rolling(time=7, center=True).mean()\n",
351351
"\n",
352-
"fig = da_smooth.pxplot.line(\n",
352+
"fig = da_smooth.plotly.line(\n",
353353
" title=\"7-Day Rolling Mean\",\n",
354354
")\n",
355355
"fig"
@@ -374,7 +374,7 @@
374374
"\n",
375375
"monthly_mean = da_monthly.groupby(\"time.month\").mean()\n",
376376
"\n",
377-
"fig = monthly_mean.pxplot.line(\n",
377+
"fig = monthly_mean.plotly.line(\n",
378378
" title=\"Monthly Climatology\",\n",
379379
")\n",
380380
"fig.update_xaxes(tickmode=\"array\", tickvals=list(range(1, 13)), \n",

docs/examples/plot-types.ipynb

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"source": [
77
"# Plot Types\n",
88
"\n",
9-
"This notebook demonstrates all the plot types available in xarray-plotly."
9+
"This notebook demonstrates all the plot types available in xarray_plotly."
1010
]
1111
},
1212
{
@@ -88,7 +88,7 @@
8888
"metadata": {},
8989
"outputs": [],
9090
"source": [
91-
"fig = da_ts.pxplot.line(title=\"Line Plot\")\n",
91+
"fig = da_ts.plotly.line(title=\"Line Plot\")\n",
9292
"fig"
9393
]
9494
},
@@ -105,7 +105,7 @@
105105
"metadata": {},
106106
"outputs": [],
107107
"source": [
108-
"fig = da_ts.pxplot.line(markers=True, title=\"Line Plot with Markers\")\n",
108+
"fig = da_ts.plotly.line(markers=True, title=\"Line Plot with Markers\")\n",
109109
"fig"
110110
]
111111
},
@@ -124,7 +124,7 @@
124124
"metadata": {},
125125
"outputs": [],
126126
"source": [
127-
"fig = da_cat.pxplot.bar(title=\"Stacked Bar Chart\")\n",
127+
"fig = da_cat.plotly.bar(title=\"Stacked Bar Chart\")\n",
128128
"fig"
129129
]
130130
},
@@ -141,7 +141,7 @@
141141
"metadata": {},
142142
"outputs": [],
143143
"source": [
144-
"fig = da_cat.pxplot.bar(barmode=\"group\", title=\"Grouped Bar Chart\")\n",
144+
"fig = da_cat.plotly.bar(barmode=\"group\", title=\"Grouped Bar Chart\")\n",
145145
"fig"
146146
]
147147
},
@@ -171,7 +171,7 @@
171171
" name=\"energy\",\n",
172172
")\n",
173173
"\n",
174-
"fig = da_positive.pxplot.area(title=\"Stacked Area Chart\")\n",
174+
"fig = da_positive.plotly.area(title=\"Stacked Area Chart\")\n",
175175
"fig"
176176
]
177177
},
@@ -190,7 +190,7 @@
190190
"metadata": {},
191191
"outputs": [],
192192
"source": [
193-
"fig = da_ts.pxplot.scatter(title=\"Scatter Plot\")\n",
193+
"fig = da_ts.plotly.scatter(title=\"Scatter Plot\")\n",
194194
"fig"
195195
]
196196
},
@@ -209,7 +209,7 @@
209209
"metadata": {},
210210
"outputs": [],
211211
"source": [
212-
"fig = da_2d.pxplot.scatter(x=\"lon\", y=\"lat\", color=\"value\", title=\"Lat/Lon Scatter\")\n",
212+
"fig = da_2d.plotly.scatter(x=\"lon\", y=\"lat\", color=\"value\", title=\"Lat/Lon Scatter\")\n",
213213
"fig"
214214
]
215215
},
@@ -236,7 +236,7 @@
236236
" name=\"response\",\n",
237237
")\n",
238238
"\n",
239-
"fig = da_dist.pxplot.box(title=\"Box Plot\")\n",
239+
"fig = da_dist.plotly.box(title=\"Box Plot\")\n",
240240
"fig"
241241
]
242242
},
@@ -255,7 +255,7 @@
255255
"metadata": {},
256256
"outputs": [],
257257
"source": [
258-
"fig = da_2d.pxplot.imshow(title=\"Heatmap\")\n",
258+
"fig = da_2d.plotly.imshow(title=\"Heatmap\")\n",
259259
"fig"
260260
]
261261
},
@@ -272,7 +272,7 @@
272272
"metadata": {},
273273
"outputs": [],
274274
"source": [
275-
"fig = da_2d.pxplot.imshow(\n",
275+
"fig = da_2d.plotly.imshow(\n",
276276
" color_continuous_scale=\"Viridis\",\n",
277277
" title=\"Heatmap with Viridis colorscale\",\n",
278278
")\n",
@@ -306,7 +306,7 @@
306306
" name=\"value\",\n",
307307
")\n",
308308
"\n",
309-
"fig = da_3d.pxplot.line(\n",
309+
"fig = da_3d.plotly.line(\n",
310310
" facet_col=\"city\",\n",
311311
" facet_row=\"scenario\",\n",
312312
" title=\"Faceted Line Plot\",\n",
@@ -341,7 +341,7 @@
341341
" name=\"sales\",\n",
342342
")\n",
343343
"\n",
344-
"fig = da_monthly.pxplot.bar(\n",
344+
"fig = da_monthly.plotly.bar(\n",
345345
" x=\"product\",\n",
346346
" animation_frame=\"month\",\n",
347347
" title=\"Monthly Sales (Animated)\",\n",

0 commit comments

Comments
 (0)