@@ -101,8 +101,8 @@ def get_options() -> dict[str, Any]:
101101
102102 Examples
103103 --------
104- >>> import xarray_plotly as xp
105- >>> xp .get_options()
104+ >>> from xarray_plotly import config
105+ >>> config .get_options()
106106 {'label_use_long_name': True, 'label_include_units': True, ...}
107107 """
108108 return _options .to_dict ()
@@ -142,12 +142,12 @@ def set_options(
142142 --------
143143 Set globally:
144144
145- >>> import xarray_plotly as xp
146- >>> xp. config.set_options(label_include_units=False)
145+ >>> from xarray_plotly import config
146+ >>> config.set_options(label_include_units=False)
147147
148148 Use as context manager:
149149
150- >>> with xp. config.set_options(label_include_units=False):
150+ >>> with config.set_options(label_include_units=False):
151151 ... fig = xpx(da).line() # No units in labels
152152 >>> # Units are back after the context
153153 """
@@ -181,3 +181,23 @@ def set_options(
181181 _options .label_include_units = old_values ["label_include_units" ]
182182 _options .label_unit_format = old_values ["label_unit_format" ]
183183 _options .slot_orders = old_values ["slot_orders" ]
184+
185+
186+ def notebook (renderer : str = "notebook" ) -> None :
187+ """
188+ Configure Plotly for Jupyter notebook rendering.
189+
190+ Parameters
191+ ----------
192+ renderer : str, optional
193+ The Plotly renderer to use. Default is "notebook".
194+ Other options include "jupyterlab", "colab", "kaggle", etc.
195+
196+ Examples
197+ --------
198+ >>> from xarray_plotly import config
199+ >>> config.notebook() # Configure for Jupyter notebooks
200+ """
201+ import plotly .io as pio
202+
203+ pio .renderers .default = renderer
0 commit comments