holoviz / hvplot

A high-level plotting API for pandas, dask, xarray, and networkx built on HoloViews
https://hvplot.holoviz.org
BSD 3-Clause "New" or "Revised" License
1.09k stars 105 forks source link

Changing the backend in standalone script #1373

Open knolljo opened 2 months ago

knolljo commented 2 months ago

ALL software version info

hvplot==0.10.0 polars==1.2.1 plotly==5.22.0 bokeh==3.4.2

Description of expected behavior and the observed behavior

I'm coming from this issue https://github.com/pola-rs/polars/issues/17647. Changing the backend doesn't work, when using a polars dataframe with their plot namespace inside a standalone script or marimo notebooks. Somehow it works when using jupyter=1.0.0.

Complete, minimal, self-contained example code that reproduces the issue

This script shows a bokeh plot, even though plotly was set as a backend:

import polars as pl
import hvplot

hvplot.extension("plotly")   # Setting the backend
plt = pl.DataFrame({"x": [1, 2, 3], "y": [3, 2, 1]}).plot.bar()
hvplot.show(plt)
maximlt commented 2 months ago

Hi @knolljo and thanks for opening this issue, we plan to have a closer look into how the extension loading affects Polars users in the context of https://github.com/holoviz/hvplot/pull/1359.