quarto-dev / quarto-dev/quarto-cli
Vector graphics produced by the Julia Luxor package not being rendered in Quarto
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 6k
- Forks
- 458
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 41
Description
I set up the Julia kernel for Quarto documents in RStudio, following the instructions on the Quarto website, and I reproduced the Plots demo in https://quarto.org/docs/computations/julia.html
However, when I installed the Julia package Luxor, I rendered my Quarto document without any errors, but it did not produce a plot of the turtle graphics (only the value true) that I was trying to reproduce from https://juliagraphics.github.io/Luxor.jl/v1.0/turtle.html
I did modify the Julia code in their example and removed the turtle emoji and the turtle image (turtles.png). I thought that maybe the issue was related to the graphics device and tried using different graphics devices, but to no avail.
It appears that the drawing function can create a file with the drawing, which can be specified in the function Drawing(600, 400, :png, "test.png") with the file name test.png, but also have the png file in the memory, specified by the argument :png. So, I just loaded the image file after the Julia code gets executed. I guess that's one quick solution, but it would be much better if the graphics get captured and properly embedded into the final output after rendering the qmd document. I also wondered how to suppress the value true being returned when I render the qmd document. The chunk option results='hide' does not to work.
Finally, when I run the Julia code chunk inside the Quarto document, RStudio crashes, the R session gets aborted and I have to restart my R session. I do have the JuliaCall R package installed. Below is the qmd file, where the Julia packages Luxor and Colors have been installed:
---
title: "Luxor Turtle Graphics"
format: html
---
```{julia}
using Luxor, Colors
Drawing(600, 400, :png, "test.png")
origin()
background("midnightblue")
t = Turtle()
Pencolor(t, "cyan")
Penwidth(t, 1.5)
global n = 5
for i in 1:400
Forward(t, n)
Turn(t, 89.5)
HueShift(t)
n += 0.75
end
fontsize(20)
finish()
```
{width="70%"}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the shown Quarto document with its Julia chunk, Luxor turtle example, and embedded test.png image, using the Quarto Julia computation documentation as context. Check separately whether rendered graphics are captured, whether the returned true value can be hidden, and whether running the chunk in RStudio causes the reported crash. Done means the vector drawing is embedded in the rendered output without a workaround and the documented execution path remains stable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia, r
- Domain
- data-visualization, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100