Vector graphics produced by the Julia Luxor package not being rendered in Quarto

I was quite happy when I managed to set up the Julia kernel for Quarto documents in RStudio, following the instructions on the Quarto website, and I reproduced the Plots demo in Quarto - Using Julia

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) I was trying to reproduce from Turtle graphics · Luxor
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, but I tried using dev="CairoSVG", after installing the Cairo package. I tried several other devices but nothing seems to work. I would love to be able to render vector graphics produced by the Julia Luxor package in Quarto documents.

Any advice would be greatly appreciated. Thanks!

It is possible this is an issue within Quarto support for this Julia package. Can you share a reproducible example ?

After installing first the Luxor and Colors Julia packages, here is an example of a Julia code chunk with a Luxor turtle graphics in a Quarto document:

using Luxor, Colors
Drawing(600, 400)

t = Turtle() 
Pencolor(t, "cyan")
Penwidth(t, 1.5)
global n = 5
for i in 1:400
    Forward(t, n)
    Turn(t, 89.5)
    n += 0.75

After looking into this a bit more, it appears that the drawing function creates a file with the drawing, and the file name can be specified in the function Drawing(600, 400, :png, "test.png"), where the file name is test.png, but the drawing function also creates the png file in the memory, specified by the argument :png.

There must be a way to capture the image from memory and embed it into the Quarto document as well as the output HTML or PDF file, after rendering the Quarto document.

Also, how can I suppress the value true being returned when I render the qmd document? The chunk option results='hide' does not suppress it.

It would be great if we can use the Luxor package to create amazing Turtle Graphics for educational purpose. I wish there were a Turtle Graphics package based on ggplot2! :frowning_face:

Can you share a full Qmd document or even a reproducible quarto project in a github repo ?

I believe this is something not correctly supported in Quarto and should be filled as a feature request for next versions

I submitted a GitHub issue:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.