xarray-plotly 0.0.1__tar.gz → 0.0.2__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.2/PKG-INFO +84 -0
- xarray_plotly-0.0.2/README.md +43 -0
- xarray_plotly-0.0.2/docs/api.md +28 -0
- {xarray_plotly-0.0.1 → xarray_plotly-0.0.2}/docs/getting-started.ipynb +1 -1
- xarray_plotly-0.0.2/docs/index.md +11 -0
- {xarray_plotly-0.0.1 → xarray_plotly-0.0.2}/mkdocs.yml +1 -1
- xarray_plotly-0.0.2/xarray_plotly/__init__.py +81 -0
- xarray_plotly-0.0.2/xarray_plotly/accessor.py +275 -0
- {xarray_plotly-0.0.1 → xarray_plotly-0.0.2}/xarray_plotly/common.py +45 -63
- {xarray_plotly-0.0.1 → xarray_plotly-0.0.2}/xarray_plotly/config.py +48 -73
- xarray_plotly-0.0.2/xarray_plotly.egg-info/PKG-INFO +84 -0
- xarray_plotly-0.0.1/PKG-INFO +0 -175
- xarray_plotly-0.0.1/README.md +0 -134
- xarray_plotly-0.0.1/docs/api.md +0 -90
- xarray_plotly-0.0.1/docs/index.md +0 -90
- xarray_plotly-0.0.1/xarray_plotly/__init__.py +0 -73
- xarray_plotly-0.0.1/xarray_plotly/accessor.py +0 -336
- xarray_plotly-0.0.1/xarray_plotly.egg-info/PKG-INFO +0 -175
- {xarray_plotly-0.0.1 → xarray_plotly-0.0.2}/.github/workflows/ci.yml +0 -0
- {xarray_plotly-0.0.1 → xarray_plotly-0.0.2}/.github/workflows/docs.yml +0 -0
- {xarray_plotly-0.0.1 → xarray_plotly-0.0.2}/.github/workflows/release.yml +0 -0
- {xarray_plotly-0.0.1 → xarray_plotly-0.0.2}/.gitignore +0 -0
- {xarray_plotly-0.0.1 → xarray_plotly-0.0.2}/.pre-commit-config.yaml +0 -0
- {xarray_plotly-0.0.1 → xarray_plotly-0.0.2}/CONTRIBUTING.md +0 -0
- {xarray_plotly-0.0.1 → xarray_plotly-0.0.2}/LICENSE +0 -0
- {xarray_plotly-0.0.1 → xarray_plotly-0.0.2}/docs/examples/advanced.ipynb +0 -0
- {xarray_plotly-0.0.1 → xarray_plotly-0.0.2}/docs/examples/plot-types.ipynb +0 -0
- {xarray_plotly-0.0.1 → xarray_plotly-0.0.2}/pyproject.toml +0 -0
- {xarray_plotly-0.0.1 → xarray_plotly-0.0.2}/setup.cfg +0 -0
- {xarray_plotly-0.0.1 → xarray_plotly-0.0.2}/tests/__init__.py +0 -0
- {xarray_plotly-0.0.1 → xarray_plotly-0.0.2}/tests/test_accessor.py +0 -0
- {xarray_plotly-0.0.1 → xarray_plotly-0.0.2}/tests/test_common.py +0 -0
- {xarray_plotly-0.0.1 → xarray_plotly-0.0.2}/tests/test_config.py +0 -0
- {xarray_plotly-0.0.1 → xarray_plotly-0.0.2}/xarray_plotly/plotting.py +0 -0
- {xarray_plotly-0.0.1 → xarray_plotly-0.0.2}/xarray_plotly/py.typed +0 -0
- {xarray_plotly-0.0.1 → xarray_plotly-0.0.2}/xarray_plotly.egg-info/SOURCES.txt +0 -0
- {xarray_plotly-0.0.1 → xarray_plotly-0.0.2}/xarray_plotly.egg-info/dependency_links.txt +0 -0
- {xarray_plotly-0.0.1 → xarray_plotly-0.0.2}/xarray_plotly.egg-info/requires.txt +0 -0
- {xarray_plotly-0.0.1 → xarray_plotly-0.0.2}/xarray_plotly.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: xarray_plotly
|
|
3
|
+
Version: 0.0.2
|
|
4
|
+
Summary: Interactive Plotly Express plotting accessor for xarray
|
|
5
|
+
Author: Felix
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/FBumann/xarray_plotly
|
|
8
|
+
Project-URL: Documentation, https://fbumann.github.io/xarray_plotly
|
|
9
|
+
Project-URL: Repository, https://github.com/FBumann/xarray_plotly
|
|
10
|
+
Keywords: xarray,plotly,visualization,interactive,plotting
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: xarray>=2023.1.0
|
|
25
|
+
Requires-Dist: plotly>=5.0.0
|
|
26
|
+
Requires-Dist: pandas>=1.5.0
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
29
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
30
|
+
Requires-Dist: mypy>=1.0; extra == "dev"
|
|
31
|
+
Requires-Dist: ruff>=0.4; extra == "dev"
|
|
32
|
+
Requires-Dist: pre-commit>=3.0; extra == "dev"
|
|
33
|
+
Requires-Dist: nbstripout>=0.6; extra == "dev"
|
|
34
|
+
Provides-Extra: docs
|
|
35
|
+
Requires-Dist: mkdocs>=1.5; extra == "docs"
|
|
36
|
+
Requires-Dist: mkdocs-material>=9.0; extra == "docs"
|
|
37
|
+
Requires-Dist: mkdocstrings[python]>=0.24; extra == "docs"
|
|
38
|
+
Requires-Dist: mkdocs-jupyter>=0.24; extra == "docs"
|
|
39
|
+
Requires-Dist: mkdocs-plotly-plugin>=0.1; extra == "docs"
|
|
40
|
+
Dynamic: license-file
|
|
41
|
+
|
|
42
|
+
# xarray_plotly
|
|
43
|
+
|
|
44
|
+
**Interactive Plotly Express plotting for xarray**
|
|
45
|
+
|
|
46
|
+
[](https://badge.fury.io/py/xarray_plotly)
|
|
47
|
+
[](https://pypi.org/project/xarray_plotly/)
|
|
48
|
+
[](https://fbumann.github.io/xarray_plotly/)
|
|
49
|
+
|
|
50
|
+
## Installation
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pip install xarray_plotly
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Quick Start
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
import xarray as xr
|
|
60
|
+
import numpy as np
|
|
61
|
+
import xarray_plotly # registers the accessor
|
|
62
|
+
|
|
63
|
+
da = xr.DataArray(
|
|
64
|
+
np.random.randn(100, 3).cumsum(axis=0),
|
|
65
|
+
dims=["time", "city"],
|
|
66
|
+
coords={"time": np.arange(100), "city": ["NYC", "LA", "Chicago"]},
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
# Accessor style
|
|
70
|
+
fig = da.plotly.line()
|
|
71
|
+
fig.show()
|
|
72
|
+
|
|
73
|
+
# Or with xpx() for IDE code completion
|
|
74
|
+
from xarray_plotly import xpx
|
|
75
|
+
fig = xpx(da).line()
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Documentation
|
|
79
|
+
|
|
80
|
+
Full documentation: [https://fbumann.github.io/xarray_plotly](https://fbumann.github.io/xarray_plotly)
|
|
81
|
+
|
|
82
|
+
## License
|
|
83
|
+
|
|
84
|
+
MIT
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# xarray_plotly
|
|
2
|
+
|
|
3
|
+
**Interactive Plotly Express plotting for xarray**
|
|
4
|
+
|
|
5
|
+
[](https://badge.fury.io/py/xarray_plotly)
|
|
6
|
+
[](https://pypi.org/project/xarray_plotly/)
|
|
7
|
+
[](https://fbumann.github.io/xarray_plotly/)
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pip install xarray_plotly
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Quick Start
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
import xarray as xr
|
|
19
|
+
import numpy as np
|
|
20
|
+
import xarray_plotly # registers the accessor
|
|
21
|
+
|
|
22
|
+
da = xr.DataArray(
|
|
23
|
+
np.random.randn(100, 3).cumsum(axis=0),
|
|
24
|
+
dims=["time", "city"],
|
|
25
|
+
coords={"time": np.arange(100), "city": ["NYC", "LA", "Chicago"]},
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
# Accessor style
|
|
29
|
+
fig = da.plotly.line()
|
|
30
|
+
fig.show()
|
|
31
|
+
|
|
32
|
+
# Or with xpx() for IDE code completion
|
|
33
|
+
from xarray_plotly import xpx
|
|
34
|
+
fig = xpx(da).line()
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Documentation
|
|
38
|
+
|
|
39
|
+
Full documentation: [https://fbumann.github.io/xarray_plotly](https://fbumann.github.io/xarray_plotly)
|
|
40
|
+
|
|
41
|
+
## License
|
|
42
|
+
|
|
43
|
+
MIT
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# API Reference
|
|
2
|
+
|
|
3
|
+
::: xarray_plotly.xpx
|
|
4
|
+
|
|
5
|
+
::: xarray_plotly.accessor.DataArrayPlotlyAccessor
|
|
6
|
+
options:
|
|
7
|
+
members:
|
|
8
|
+
- line
|
|
9
|
+
- bar
|
|
10
|
+
- area
|
|
11
|
+
- scatter
|
|
12
|
+
- box
|
|
13
|
+
- imshow
|
|
14
|
+
|
|
15
|
+
::: xarray_plotly.config
|
|
16
|
+
options:
|
|
17
|
+
members:
|
|
18
|
+
- notebook
|
|
19
|
+
- get_options
|
|
20
|
+
- set_options
|
|
21
|
+
- Options
|
|
22
|
+
|
|
23
|
+
::: xarray_plotly.common
|
|
24
|
+
options:
|
|
25
|
+
members:
|
|
26
|
+
- auto
|
|
27
|
+
- SLOT_ORDERS
|
|
28
|
+
- assign_slots
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
::: xarray_plotly
|
|
2
|
+
options:
|
|
3
|
+
show_root_heading: true
|
|
4
|
+
members: false
|
|
5
|
+
|
|
6
|
+
## Next Steps
|
|
7
|
+
|
|
8
|
+
- [Getting Started](getting-started.ipynb) - Interactive tutorial
|
|
9
|
+
- [Plot Types](examples/plot-types.ipynb) - All available plot types
|
|
10
|
+
- [Advanced Usage](examples/advanced.ipynb) - Configuration and customization
|
|
11
|
+
- [API Reference](api.md) - Full API documentation
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"""Interactive Plotly Express plotting for xarray.
|
|
2
|
+
|
|
3
|
+
This package provides a `plotly` accessor for xarray DataArray objects,
|
|
4
|
+
enabling interactive visualization with Plotly Express.
|
|
5
|
+
|
|
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
|
|
12
|
+
|
|
13
|
+
Usage:
|
|
14
|
+
Accessor style::
|
|
15
|
+
|
|
16
|
+
import xarray_plotly
|
|
17
|
+
fig = da.plotly.line()
|
|
18
|
+
|
|
19
|
+
Function style (recommended for IDE completion)::
|
|
20
|
+
|
|
21
|
+
from xarray_plotly import xpx
|
|
22
|
+
fig = xpx(da).line()
|
|
23
|
+
|
|
24
|
+
Example:
|
|
25
|
+
```python
|
|
26
|
+
import xarray as xr
|
|
27
|
+
import numpy as np
|
|
28
|
+
from xarray_plotly import xpx
|
|
29
|
+
|
|
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
|
+
```
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
from importlib.metadata import version
|
|
41
|
+
|
|
42
|
+
from xarray import DataArray, register_dataarray_accessor
|
|
43
|
+
|
|
44
|
+
from xarray_plotly import config
|
|
45
|
+
from xarray_plotly.accessor import DataArrayPlotlyAccessor
|
|
46
|
+
from xarray_plotly.common import SLOT_ORDERS, auto
|
|
47
|
+
|
|
48
|
+
__all__ = [
|
|
49
|
+
"SLOT_ORDERS",
|
|
50
|
+
"DataArrayPlotlyAccessor",
|
|
51
|
+
"auto",
|
|
52
|
+
"config",
|
|
53
|
+
"xpx",
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def xpx(da: DataArray) -> DataArrayPlotlyAccessor:
|
|
58
|
+
"""Get the plotly accessor for a DataArray with full IDE code completion.
|
|
59
|
+
|
|
60
|
+
This is an alternative to `da.plotly` that provides proper type hints
|
|
61
|
+
and code completion in IDEs.
|
|
62
|
+
|
|
63
|
+
Args:
|
|
64
|
+
da: The DataArray to plot.
|
|
65
|
+
|
|
66
|
+
Returns:
|
|
67
|
+
The accessor with plotting methods (line, bar, area, scatter, box, imshow).
|
|
68
|
+
|
|
69
|
+
Example:
|
|
70
|
+
```python
|
|
71
|
+
from xarray_plotly import xpx
|
|
72
|
+
fig = xpx(da).line() # Full code completion works here
|
|
73
|
+
```
|
|
74
|
+
"""
|
|
75
|
+
return DataArrayPlotlyAccessor(da)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
__version__ = version("xarray_plotly")
|
|
79
|
+
|
|
80
|
+
# Register the accessor
|
|
81
|
+
register_dataarray_accessor("plotly")(DataArrayPlotlyAccessor)
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
"""Accessor classes for Plotly Express plotting on DataArray."""
|
|
2
|
+
|
|
3
|
+
from typing import Any, ClassVar
|
|
4
|
+
|
|
5
|
+
import plotly.graph_objects as go
|
|
6
|
+
from xarray import DataArray
|
|
7
|
+
|
|
8
|
+
from xarray_plotly import plotting
|
|
9
|
+
from xarray_plotly.common import SlotValue, auto
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class DataArrayPlotlyAccessor:
|
|
13
|
+
"""Plotly Express plotting accessor for xarray DataArray.
|
|
14
|
+
|
|
15
|
+
Dimensions are automatically assigned to plot slots by position.
|
|
16
|
+
All methods return Plotly Figure objects for interactive visualization.
|
|
17
|
+
|
|
18
|
+
Available methods: line, bar, area, scatter, box, imshow
|
|
19
|
+
|
|
20
|
+
Args:
|
|
21
|
+
darray: The DataArray to plot.
|
|
22
|
+
|
|
23
|
+
Example:
|
|
24
|
+
```python
|
|
25
|
+
import xarray as xr
|
|
26
|
+
import numpy as np
|
|
27
|
+
|
|
28
|
+
da = xr.DataArray(np.random.rand(10, 3), dims=["time", "city"])
|
|
29
|
+
fig = da.plotly.line() # Auto: time->x, city->color
|
|
30
|
+
fig = da.plotly.line(color="time", x="city") # Explicit
|
|
31
|
+
fig = da.plotly.line(color=None) # Skip slot
|
|
32
|
+
fig.update_layout(title="My Plot") # Customize
|
|
33
|
+
```
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
__all__: ClassVar = ["line", "bar", "area", "scatter", "box", "imshow"]
|
|
37
|
+
|
|
38
|
+
def __init__(self, darray: DataArray) -> None:
|
|
39
|
+
self._da = darray
|
|
40
|
+
|
|
41
|
+
def __dir__(self) -> list[str]:
|
|
42
|
+
"""List available plot methods."""
|
|
43
|
+
return list(self.__all__) + list(super().__dir__())
|
|
44
|
+
|
|
45
|
+
def line(
|
|
46
|
+
self,
|
|
47
|
+
*,
|
|
48
|
+
x: SlotValue = auto,
|
|
49
|
+
color: SlotValue = auto,
|
|
50
|
+
line_dash: SlotValue = auto,
|
|
51
|
+
symbol: SlotValue = auto,
|
|
52
|
+
facet_col: SlotValue = auto,
|
|
53
|
+
facet_row: SlotValue = auto,
|
|
54
|
+
animation_frame: SlotValue = auto,
|
|
55
|
+
**px_kwargs: Any,
|
|
56
|
+
) -> go.Figure:
|
|
57
|
+
"""Create an interactive line plot.
|
|
58
|
+
|
|
59
|
+
Slot order: x -> color -> line_dash -> symbol -> facet_col -> facet_row -> animation_frame
|
|
60
|
+
|
|
61
|
+
Args:
|
|
62
|
+
x: Dimension for x-axis. Default: first dimension.
|
|
63
|
+
color: Dimension for color grouping. Default: second dimension.
|
|
64
|
+
line_dash: Dimension for line dash style. Default: third dimension.
|
|
65
|
+
symbol: Dimension for marker symbol. Default: fourth dimension.
|
|
66
|
+
facet_col: Dimension for subplot columns. Default: fifth dimension.
|
|
67
|
+
facet_row: Dimension for subplot rows. Default: sixth dimension.
|
|
68
|
+
animation_frame: Dimension for animation. Default: seventh dimension.
|
|
69
|
+
**px_kwargs: Additional arguments passed to `plotly.express.line()`.
|
|
70
|
+
|
|
71
|
+
Returns:
|
|
72
|
+
Interactive Plotly Figure.
|
|
73
|
+
"""
|
|
74
|
+
return plotting.line(
|
|
75
|
+
self._da,
|
|
76
|
+
x=x,
|
|
77
|
+
color=color,
|
|
78
|
+
line_dash=line_dash,
|
|
79
|
+
symbol=symbol,
|
|
80
|
+
facet_col=facet_col,
|
|
81
|
+
facet_row=facet_row,
|
|
82
|
+
animation_frame=animation_frame,
|
|
83
|
+
**px_kwargs,
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
def bar(
|
|
87
|
+
self,
|
|
88
|
+
*,
|
|
89
|
+
x: SlotValue = auto,
|
|
90
|
+
color: SlotValue = auto,
|
|
91
|
+
pattern_shape: SlotValue = auto,
|
|
92
|
+
facet_col: SlotValue = auto,
|
|
93
|
+
facet_row: SlotValue = auto,
|
|
94
|
+
animation_frame: SlotValue = auto,
|
|
95
|
+
**px_kwargs: Any,
|
|
96
|
+
) -> go.Figure:
|
|
97
|
+
"""Create an interactive bar chart.
|
|
98
|
+
|
|
99
|
+
Slot order: x -> color -> pattern_shape -> facet_col -> facet_row -> animation_frame
|
|
100
|
+
|
|
101
|
+
Args:
|
|
102
|
+
x: Dimension for x-axis. Default: first dimension.
|
|
103
|
+
color: Dimension for color grouping. Default: second dimension.
|
|
104
|
+
pattern_shape: Dimension for bar fill pattern. Default: third dimension.
|
|
105
|
+
facet_col: Dimension for subplot columns. Default: fourth dimension.
|
|
106
|
+
facet_row: Dimension for subplot rows. Default: fifth dimension.
|
|
107
|
+
animation_frame: Dimension for animation. Default: sixth dimension.
|
|
108
|
+
**px_kwargs: Additional arguments passed to `plotly.express.bar()`.
|
|
109
|
+
|
|
110
|
+
Returns:
|
|
111
|
+
Interactive Plotly Figure.
|
|
112
|
+
"""
|
|
113
|
+
return plotting.bar(
|
|
114
|
+
self._da,
|
|
115
|
+
x=x,
|
|
116
|
+
color=color,
|
|
117
|
+
pattern_shape=pattern_shape,
|
|
118
|
+
facet_col=facet_col,
|
|
119
|
+
facet_row=facet_row,
|
|
120
|
+
animation_frame=animation_frame,
|
|
121
|
+
**px_kwargs,
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
def area(
|
|
125
|
+
self,
|
|
126
|
+
*,
|
|
127
|
+
x: SlotValue = auto,
|
|
128
|
+
color: SlotValue = auto,
|
|
129
|
+
pattern_shape: SlotValue = auto,
|
|
130
|
+
facet_col: SlotValue = auto,
|
|
131
|
+
facet_row: SlotValue = auto,
|
|
132
|
+
animation_frame: SlotValue = auto,
|
|
133
|
+
**px_kwargs: Any,
|
|
134
|
+
) -> go.Figure:
|
|
135
|
+
"""Create an interactive stacked area chart.
|
|
136
|
+
|
|
137
|
+
Slot order: x -> color -> pattern_shape -> facet_col -> facet_row -> animation_frame
|
|
138
|
+
|
|
139
|
+
Args:
|
|
140
|
+
x: Dimension for x-axis. Default: first dimension.
|
|
141
|
+
color: Dimension for color/stacking. Default: second dimension.
|
|
142
|
+
pattern_shape: Dimension for fill pattern. Default: third dimension.
|
|
143
|
+
facet_col: Dimension for subplot columns. Default: fourth dimension.
|
|
144
|
+
facet_row: Dimension for subplot rows. Default: fifth dimension.
|
|
145
|
+
animation_frame: Dimension for animation. Default: sixth dimension.
|
|
146
|
+
**px_kwargs: Additional arguments passed to `plotly.express.area()`.
|
|
147
|
+
|
|
148
|
+
Returns:
|
|
149
|
+
Interactive Plotly Figure.
|
|
150
|
+
"""
|
|
151
|
+
return plotting.area(
|
|
152
|
+
self._da,
|
|
153
|
+
x=x,
|
|
154
|
+
color=color,
|
|
155
|
+
pattern_shape=pattern_shape,
|
|
156
|
+
facet_col=facet_col,
|
|
157
|
+
facet_row=facet_row,
|
|
158
|
+
animation_frame=animation_frame,
|
|
159
|
+
**px_kwargs,
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
def scatter(
|
|
163
|
+
self,
|
|
164
|
+
*,
|
|
165
|
+
x: SlotValue = auto,
|
|
166
|
+
y: SlotValue | str = "value",
|
|
167
|
+
color: SlotValue = auto,
|
|
168
|
+
symbol: SlotValue = auto,
|
|
169
|
+
facet_col: SlotValue = auto,
|
|
170
|
+
facet_row: SlotValue = auto,
|
|
171
|
+
animation_frame: SlotValue = auto,
|
|
172
|
+
**px_kwargs: Any,
|
|
173
|
+
) -> go.Figure:
|
|
174
|
+
"""Create an interactive scatter plot.
|
|
175
|
+
|
|
176
|
+
By default, y-axis shows the DataArray values. Set y to a dimension
|
|
177
|
+
name to create dimension-vs-dimension plots (e.g., lat vs lon).
|
|
178
|
+
|
|
179
|
+
Slot order: x -> color -> symbol -> facet_col -> facet_row -> animation_frame
|
|
180
|
+
|
|
181
|
+
Args:
|
|
182
|
+
x: Dimension for x-axis. Default: first dimension.
|
|
183
|
+
y: What to plot on y-axis. Default "value" uses DataArray values.
|
|
184
|
+
Can be a dimension name for dimension vs dimension plots.
|
|
185
|
+
color: Dimension for color grouping, or "value" for DataArray values.
|
|
186
|
+
symbol: Dimension for marker symbol. Default: third dimension.
|
|
187
|
+
facet_col: Dimension for subplot columns. Default: fourth dimension.
|
|
188
|
+
facet_row: Dimension for subplot rows. Default: fifth dimension.
|
|
189
|
+
animation_frame: Dimension for animation. Default: sixth dimension.
|
|
190
|
+
**px_kwargs: Additional arguments passed to `plotly.express.scatter()`.
|
|
191
|
+
|
|
192
|
+
Returns:
|
|
193
|
+
Interactive Plotly Figure.
|
|
194
|
+
"""
|
|
195
|
+
return plotting.scatter(
|
|
196
|
+
self._da,
|
|
197
|
+
x=x,
|
|
198
|
+
y=y,
|
|
199
|
+
color=color,
|
|
200
|
+
symbol=symbol,
|
|
201
|
+
facet_col=facet_col,
|
|
202
|
+
facet_row=facet_row,
|
|
203
|
+
animation_frame=animation_frame,
|
|
204
|
+
**px_kwargs,
|
|
205
|
+
)
|
|
206
|
+
|
|
207
|
+
def box(
|
|
208
|
+
self,
|
|
209
|
+
*,
|
|
210
|
+
x: SlotValue = auto,
|
|
211
|
+
color: SlotValue = None,
|
|
212
|
+
facet_col: SlotValue = None,
|
|
213
|
+
facet_row: SlotValue = None,
|
|
214
|
+
animation_frame: SlotValue = None,
|
|
215
|
+
**px_kwargs: Any,
|
|
216
|
+
) -> go.Figure:
|
|
217
|
+
"""Create an interactive box plot.
|
|
218
|
+
|
|
219
|
+
By default, only the first dimension is assigned to x; all other
|
|
220
|
+
dimensions are aggregated into the box statistics.
|
|
221
|
+
|
|
222
|
+
Slot order: x -> color -> facet_col -> facet_row -> animation_frame
|
|
223
|
+
|
|
224
|
+
Args:
|
|
225
|
+
x: Dimension for x-axis categories. Default: first dimension.
|
|
226
|
+
color: Dimension for color grouping. Default: None (aggregated).
|
|
227
|
+
facet_col: Dimension for subplot columns. Default: None (aggregated).
|
|
228
|
+
facet_row: Dimension for subplot rows. Default: None (aggregated).
|
|
229
|
+
animation_frame: Dimension for animation. Default: None (aggregated).
|
|
230
|
+
**px_kwargs: Additional arguments passed to `plotly.express.box()`.
|
|
231
|
+
|
|
232
|
+
Returns:
|
|
233
|
+
Interactive Plotly Figure.
|
|
234
|
+
"""
|
|
235
|
+
return plotting.box(
|
|
236
|
+
self._da,
|
|
237
|
+
x=x,
|
|
238
|
+
color=color,
|
|
239
|
+
facet_col=facet_col,
|
|
240
|
+
facet_row=facet_row,
|
|
241
|
+
animation_frame=animation_frame,
|
|
242
|
+
**px_kwargs,
|
|
243
|
+
)
|
|
244
|
+
|
|
245
|
+
def imshow(
|
|
246
|
+
self,
|
|
247
|
+
*,
|
|
248
|
+
x: SlotValue = auto,
|
|
249
|
+
y: SlotValue = auto,
|
|
250
|
+
facet_col: SlotValue = auto,
|
|
251
|
+
animation_frame: SlotValue = auto,
|
|
252
|
+
**px_kwargs: Any,
|
|
253
|
+
) -> go.Figure:
|
|
254
|
+
"""Create an interactive heatmap image.
|
|
255
|
+
|
|
256
|
+
Slot order: y (rows) -> x (columns) -> facet_col -> animation_frame
|
|
257
|
+
|
|
258
|
+
Args:
|
|
259
|
+
x: Dimension for x-axis (columns). Default: second dimension.
|
|
260
|
+
y: Dimension for y-axis (rows). Default: first dimension.
|
|
261
|
+
facet_col: Dimension for subplot columns. Default: third dimension.
|
|
262
|
+
animation_frame: Dimension for animation. Default: fourth dimension.
|
|
263
|
+
**px_kwargs: Additional arguments passed to `plotly.express.imshow()`.
|
|
264
|
+
|
|
265
|
+
Returns:
|
|
266
|
+
Interactive Plotly Figure.
|
|
267
|
+
"""
|
|
268
|
+
return plotting.imshow(
|
|
269
|
+
self._da,
|
|
270
|
+
x=x,
|
|
271
|
+
y=y,
|
|
272
|
+
facet_col=facet_col,
|
|
273
|
+
animation_frame=animation_frame,
|
|
274
|
+
**px_kwargs,
|
|
275
|
+
)
|