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%"}
The text was updated successfully, but these errors were encountered:
bkostadi
changed the title
Feature Request: Vector graphics produced by the Julia Luxor package not being rendered in Quarto
Vector graphics produced by the Julia Luxor package not being rendered in Quarto
Jul 13, 2022
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.htmlI 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 nametest.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 valuetruebeing returned when I render the qmd document. The chunk optionresults='hide'does not to work.The text was updated successfully, but these errors were encountered: