Skip to content

Commit 75b9d5a

Browse files
committed
Improve notebook
1 parent d5fe515 commit 75b9d5a

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

docs/examples/advanced.ipynb

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,11 @@
1717
"source": [
1818
"import numpy as np\n",
1919
"import pandas as pd\n",
20-
"import plotly.io as pio\n",
2120
"import xarray as xr\n",
2221
"\n",
23-
"from xarray_plotly import xpx\n",
22+
"from xarray_plotly import config, xpx\n",
2423
"\n",
25-
"pio.renderers.default = \"notebook\""
24+
"config.notebook() # Configure Plotly for notebook rendering"
2625
]
2726
},
2827
{
@@ -64,6 +63,27 @@
6463
"fig"
6564
]
6665
},
66+
{
67+
"cell_type": "markdown",
68+
"metadata": {},
69+
"source": [
70+
"### Configuring Label Behavior\n",
71+
"\n",
72+
"Use `config.set_options()` to control how labels are extracted from attributes:"
73+
]
74+
},
75+
{
76+
"cell_type": "code",
77+
"execution_count": null,
78+
"metadata": {},
79+
"outputs": [],
80+
"source": [
81+
"# Disable units in labels\n",
82+
"with config.set_options(label_include_units=False):\n",
83+
" fig = xpx(da).line(title=\"Without Units in Labels\")\n",
84+
"fig"
85+
]
86+
},
6787
{
6888
"cell_type": "markdown",
6989
"metadata": {},

0 commit comments

Comments
 (0)