Skip to content

Commit 74b8759

Browse files
committed
Changed to google style docstrings
1 parent 5beea49 commit 74b8759

File tree

5 files changed

+236
-383
lines changed

5 files changed

+236
-383
lines changed

mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ plugins:
4242
handlers:
4343
python:
4444
options:
45-
docstring_style: numpy
45+
docstring_style: google
4646
show_source: true
4747
show_root_heading: true
4848
members_order: source

xarray_plotly/__init__.py

Lines changed: 37 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,40 @@
1-
"""
2-
xarray_plotly: Interactive Plotly Express plotting for xarray.
1+
"""Interactive Plotly Express plotting for xarray.
32
43
This package provides a `plotly` accessor for xarray DataArray objects,
54
enabling interactive visualization with Plotly Express.
65
7-
Features
8-
--------
9-
- **Interactive plots**: Zoom, pan, hover, toggle traces
10-
- **Automatic dimension assignment**: Dimensions fill slots (x, color, facet) by position
11-
- **Multiple plot types**: line, bar, area, scatter, box, imshow
12-
- **Faceting and animation**: Built-in subplot grids and animated plots
13-
- **Customizable**: Returns Plotly Figure objects for further modification
14-
15-
Usage
16-
-----
17-
Accessor style::
6+
Features:
7+
- **Interactive plots**: Zoom, pan, hover, toggle traces
8+
- **Automatic dimension assignment**: Dimensions fill slots (x, color, facet) by position
9+
- **Multiple plot types**: line, bar, area, scatter, box, imshow
10+
- **Faceting and animation**: Built-in subplot grids and animated plots
11+
- **Customizable**: Returns Plotly Figure objects for further modification
1812
19-
import xarray_plotly
20-
fig = da.plotly.line()
13+
Usage:
14+
Accessor style::
2115
22-
Function style (recommended for IDE completion)::
23-
24-
from xarray_plotly import xpx
25-
fig = xpx(da).line()
16+
import xarray_plotly
17+
fig = da.plotly.line()
2618
27-
Examples
28-
--------
29-
>>> import xarray as xr
30-
>>> import numpy as np
31-
>>> from xarray_plotly import xpx
19+
Function style (recommended for IDE completion)::
3220
33-
>>> da = xr.DataArray(
34-
... np.random.rand(10, 3, 2),
35-
... dims=["time", "city", "scenario"],
36-
... )
21+
from xarray_plotly import xpx
22+
fig = xpx(da).line()
3723
38-
>>> # Auto-assignment: time->x, city->color, scenario->facet_col
39-
>>> fig = xpx(da).line()
40-
41-
>>> # Explicit assignment
42-
>>> fig = xpx(da).line(x="time", color="scenario", facet_col="city")
24+
Example:
25+
```python
26+
import xarray as xr
27+
import numpy as np
28+
from xarray_plotly import xpx
4329
44-
>>> # Skip a slot with None
45-
>>> fig = xpx(da).line(color=None)
30+
da = xr.DataArray(
31+
np.random.rand(10, 3, 2),
32+
dims=["time", "city", "scenario"],
33+
)
34+
fig = xpx(da).line() # Auto: time->x, city->color, scenario->facet_col
35+
fig = xpx(da).line(x="time", color="scenario") # Explicit
36+
fig = xpx(da).line(color=None) # Skip slot
37+
```
4638
"""
4739

4840
from importlib.metadata import version
@@ -63,26 +55,22 @@
6355

6456

6557
def xpx(da: DataArray) -> DataArrayPlotlyAccessor:
66-
"""
67-
Get the plotly accessor for a DataArray with full IDE code completion.
58+
"""Get the plotly accessor for a DataArray with full IDE code completion.
6859
6960
This is an alternative to `da.plotly` that provides proper type hints
7061
and code completion in IDEs.
7162
72-
Parameters
73-
----------
74-
da : DataArray
75-
The DataArray to plot.
63+
Args:
64+
da: The DataArray to plot.
7665
77-
Returns
78-
-------
79-
DataArrayPlotlyAccessor
80-
The accessor with plotting methods.
66+
Returns:
67+
The accessor with plotting methods (line, bar, area, scatter, box, imshow).
8168
82-
Examples
83-
--------
84-
>>> from xarray_plotly import xpx
85-
>>> fig = xpx(da).line() # Full code completion works here
69+
Example:
70+
```python
71+
from xarray_plotly import xpx
72+
fig = xpx(da).line() # Full code completion works here
73+
```
8674
"""
8775
return DataArrayPlotlyAccessor(da)
8876

0 commit comments

Comments
 (0)