Plotly plots are not rendering #5264
-
Hi, I am trying to render plotly plots using python + quarto. I keep getting this message: Unable to display output for mime type(s): application/vnd.plotly.v1+json Is there something I need to modify/add to the yml header? |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 10 replies
-
Could you share a complete and small reproducible Quarto document? |
Beta Was this translation helpful? Give feedback.
-
@charldelaoa one of our "getting started" with python is using a plotly graph. https://quarto.org/docs/get-started/computations/text-editor.html I tested this document and it works ok. As @mcanouil we need an example to see exactly the python code you used. Also one precision based on guess from your screenshot:
I am asking because it seems in the former case, this is something that could be related to VSCODE extension
So wondering if this is happening with Quarto itself, or more something related to VSCODE / Quarto extension, and other integration |
Beta Was this translation helpful? Give feedback.
-
Running the following line in your notebook should fix it. import plotly.io as pio
pio.renderers.default = "notebook" |
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
-
Hello, In a file saved by Jupyter the cell output is Javascript content with the code of plotly. In a file saved by VSCode, there is only the data needed by plotly, not plotly itself:
It save a lot of space but it is not supported by Quarto. Adding
In VSCode force it to use the same output as Jupyter so it works with Quarto. |
Beta Was this translation helpful? Give feedback.
-
For anyone arriving here recently and for whom the notebook mentioned above does not produce plotly output: There was a breaking change in plotly-6.0 (see #12061 ). downgrade plotly using |
Beta Was this translation helpful? Give feedback.
If you're calling
quarto render file.ipnyb
you need to tell quarto explicitly in case you want to execute the notebook with--execute
. This is explained in our documentation