Replies: 2 comments 1 reply
-
Plotly output only works in HTML formats. |
Beta Was this translation helpful? Give feedback.
1 reply
-
Just let the Python cell write an image file, then include it in the Markdown: ```{python}
%%capture
import plotly.express as px
df = px.data.iris()
fig = px.density_heatmap(df, x='sepal_width', y='sepal_length', marginal_x='rug', marginal_y='histogram')
fig.write_image('myfig.svg')
```
 I'm using SVG with the To keep plots interactive when rendering to HTML, you'll have to resort to conditional divs: ::: {.content-visible when-format="html"}
```{python}
fig
```
:::
::: {.content-visible unless-format="html"}

::: Downside of these is that labels and captions need to be repeated for the HTML and non-HTML case. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I have a problem with the sample code in the Computation tutorial in the Quarto Get Stated section.
I am running Quarto in VS Code Version: 1.74.2 on a MacBook Pro running MacOS Ventura 13.1.
The code computations.qmd runs fine in VS Code in the Quarto Preview and it also generates properly the HTML file with all the graphs and plots. The problem I have is when rendering to PDF.
Then everything apart from the last Plotly plot is OK. Instead of the Plotly plot I get two lines in the PDF with the following text:
Unable to display output for mime type(s): text/html
Unable to display output for mime type(s): text/html
If I run Quarto on computations.qmd in the macOS terminal I get the same error in the PDF file.
The terminal run is the following:
frode@Frodes-Bogart Quarto % quarto render computations.qmd --to pdf
Executing 'computations.ipynb'
Cell 1/3...Done
Cell 2/3...Done
Cell 3/3...Done
pandoc
to: latex
output-file: computations.tex
standalone: true
pdf-engine: xelatex
variables:
graphics: true
tables: true
default-image-extension: pdf
metadata
documentclass: scrartcl
classoption:
- DIV=11
- numbers=noendperiod
papersize: letter
header-includes:
- '\KOMAoption{captions}{tableheading}'
block-headings: true
title: Quarto Computations
jupyter: python3
running xelatex - 1
This is XeTeX, Version 3.141592653-2.6-0.999994 (TeX Live 2022) (preloaded format=xelatex)
restricted \write18 enabled.
entering extended mode
running xelatex - 2
This is XeTeX, Version 3.141592653-2.6-0.999994 (TeX Live 2022) (preloaded format=xelatex)
restricted \write18 enabled.
entering extended mode
Output created: computations.pdf
Running a check on Quarto and Quarto tools I get:
frode@Frodes-Bogart Quarto % quarto check
[✓] Checking Quarto installation......OK
Version: 1.2.280
Path: /Applications/quarto/bin
[✓] Checking basic markdown render....OK
[✓] Checking Python 3 installation....OK
Version: 3.10.6
Path: /usr/local/opt/[email protected]/bin/python3.10
Jupyter: 5.1.2
Kernels: python3, ir
[✓] Checking Jupyter engine render....OK
[✓] Checking R installation...........OK
Version: 4.2.1
Path: /Library/Frameworks/R.framework/Resources
LibPaths:
- /Library/Frameworks/R.framework/Versions/4.2/Resources/library
rmarkdown: 2.19
[✓] Checking Knitr engine render......OK
frode@Frodes-Bogart Quarto % quarto tools check
[✓] Inspecting tools
Tool Status Installed Latest
chromium Up to date 869685 869685
tinytex Up to date v2023.01 v2023.01
I have installed in Python 3 Jupyter, Matplotlib, Plotly and Pandas
I have also tried various renderers by adding
or
pio.renderers.default = "notebook"
without that changing anything to the missing Plotly plot in the PDF output.
Does anybody know what is wrong? Am I missing something?
Best regards,
Frode
Beta Was this translation helpful? Give feedback.
All reactions