Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using with Quarto? #20

Closed
dpo opened this issue Aug 5, 2024 · 2 comments
Closed

Using with Quarto? #20

dpo opened this issue Aug 5, 2024 · 2 comments

Comments

@dpo
Copy link

dpo commented Aug 5, 2024

Thank you for this package!

When I’m at the Julia REPL producing plots with PlotlyLight, I can download the plots successfully with this package, and all is well.

However, I’m really interested in producing PDF reports using Quarto. Printing the html report from the browser works, but is not ideal as I would like to automate the process from the command line (using quarto render —to pdf), and produce a PDF version of several Markdown reports. Unfortunately, when using Quarto, images downloaded by PlotlyKaleido are nowhere to be found (at least by me), even if I export them to a hard-coded absolute path. Has anyone successfully used this kind of workflow?

Thanks!

@dpo
Copy link
Author

dpo commented Aug 5, 2024

If it's helpful, here's an example Quarto report. The issue is that I've no idea where myplot.svg is, if anywhere.

---
title: PlotlyLight and Quarto
engine: julia
---

# Environment setup

```{julia}
#| output: false
using Pkg
Pkg.activate("plotlylight-quarto")
Pkg.add("PlotlyLight")
Pkg.add("PlotlyKaleido")

using PlotlyLight
using PlotlyKaleido
PlotlyKaleido.start()
```

# A plot with PlotlyLight

```{julia}
p = plot(x = 1:200, y = cumsum(randn(200)), type="scatter", mode="lines" )
p.layout.title.text = "Your stocks"
display(p)  # this plot appears in the html rendering
```

<!-- Now I would like this plot to appear in the pdf rendering -->

```julia
PlotlyKaleido.savefig(p, "myplot.svg")
```
![](myplot.svg)

Render with quarto render report.qmd --execute --to pdf.

@dpo
Copy link
Author

dpo commented Aug 21, 2024

Nevermind. Silly user error.

```julia
PlotlyKaleido.savefig(p, "myplot.svg")
```

should be

```{julia}
PlotlyKaleido.savefig(p, "myplot.svg")
```

@dpo dpo closed this as completed Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant