Closed fecet closed 11 months ago
Ploty renders charts as interactive SVG / HTML / Javascript, which euporie's HTML renderer is not yet capable of displaying.
You can convert your figure to an PNG image (you need kaleido
installed for this), then use IPython to display the png in euporie:
%pip install --user kaleido
from IPython.display import Image
import plotly.express as px
fig = px.bar(x=["a", "b", "c"], y=[1, 3, 2])
Image(fig.to_image(format="png"), format="png")
It would be nice if plotly defined a _repr_png_
method, and returned png data as part of the _repr_mimebundle_
- I'll make a PR for this.
Even better, you can set the default plotly renderer to "png"
and figures will be displayed as images!
import plotly.io as pio
pio.renderers.default = "png"
Have a read of this page:
Thanks for your prompt response! Have some method to see the result in euprie would be good enough, does euporie plan to support interactive html in the future?
Have some method to see the result in euprie would be good enough, does euporie plan to support interactive html in the future?
As I said, you just need to pip install kaleido
, and run:
import plotly.io as pio
pio.renderers.default = "png"
in your notebook to get plotly charts to display as static images.
Realistically, I'm not going to be implementing Javascript in euporie's webview any time soon.
It seems that euprie dosn't support plotly currenly, I test it by