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? |
Replies: 7 comments 11 replies
|
Could you share a complete and small reproducible Quarto document? |
|
@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 |
|
Running the following line in your notebook should fix it. import plotly.io as pio
pio.renderers.default = "notebook" |
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. |
|
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 |
|
i used: import plotly.offline as pyo
pyo.init_notebook_mode(connected=True) |

If you're calling
quarto render file.ipnybyou need to tell quarto explicitly in case you want to execute the notebook with--execute. This is explained in our documentation