# Julia alternative for turtle graphics

**URL:** <https://discourse.julialang.org/t/julia-alternative-for-turtle-graphics/31683>\
**Category:** Visualization\
**Tags:** question, visualization\
**Created:** [November 30, 2019, 5:19am UTC](https://discourse.julialang.org/t/julia-alternative-for-turtle-graphics/31683 "2019-11-30T05:19:20Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![chakravala](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chakravala/32/6832_2.png) [@chakravala](https://discourse.julialang.org/u/chakravala)\
**Post date:** [November 30, 2019, 5:19am UTC](https://discourse.julialang.org/t/julia-alternative-for-turtle-graphics/31683/1 "2019-11-30T05:19:20Z")

</div>

A while back I made a nice [visualization of the Ramanujan tau function](https://gist.github.com/chakravala/2eed5956c0af9581fd34b9c6d1b787d5) using [python turtle graphics](https://docs.python.org/3/library/turtle.html), which I made for the 100th anniversary of this function. The turtle interface was very nice for making the graphics, what’s the best Julia alternative to achieve very similar graphics?

 ![ramanujan-tau](https://global.discourse-cdn.com/julialang/original/3X/c/9/c94b8a6bc975aa5c8309ef108b858c6c5ca281c3.png)

---

<div class="post-metadata">

**Author:** ![JeffreySarnoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jeffreysarnoff/32/1980_2.png) [@JeffreySarnoff](https://discourse.julialang.org/u/JeffreySarnoff)\
**Post date:** [November 30, 2019, 5:34am UTC](https://discourse.julialang.org/t/julia-alternative-for-turtle-graphics/31683/2 "2019-11-30T05:34:25Z")

</div>

`Luxor.jl`

---

<div class="post-metadata">

**Author:** ![Mattriks](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mattriks/32/351_2.png) [@Mattriks](https://discourse.julialang.org/u/Mattriks)\
**Post date:** [November 30, 2019, 6:02am UTC](https://discourse.julialang.org/t/julia-alternative-for-turtle-graphics/31683/3 "2019-11-30T06:02:58Z")

</div>

A declarative graphics (non-turtle!) package is [Compose](https://github.com/GiovineItalia/Compose.jl).  
There’s a “lines to circle outline” example in the [Compose docs](http://giovineitalia.github.io/Compose.jl/latest/gallery/forms/#%5Bline%5D(@ref)-1).

---

<div class="post-metadata">

**Author:** ![chakravala](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chakravala/32/6832_2.png) [@chakravala](https://discourse.julialang.org/u/chakravala)\
**Post date:** [November 30, 2019, 2:53pm UTC](https://discourse.julialang.org/t/julia-alternative-for-turtle-graphics/31683/4 "2019-11-30T14:53:48Z")

</div>

Note that in my example above, a new display window is opened, and the turtle drawing out the graphics is effectively a live animation. It’s kind of like a screensaver, that continues animating until you tell it to stop. Can these solutions do that also?

Making a static image is useful also, but what I’m after is the live animation of the turtle.

---

<div class="post-metadata">

**Author:** ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Post date:** [November 30, 2019, 3:55pm UTC](https://discourse.julialang.org/t/julia-alternative-for-turtle-graphics/31683/5 "2019-11-30T15:55:54Z")

</div>

Yes and no, from Luxor.jl - animations are easy enough, but Luxor’s 🐢’s aren’t built for speed (or indeed any kind of animation). For live graphics, you’d be better off with Makie.jl or something that does live updating in a window…

![hilbert2](https://global.discourse-cdn.com/julialang/original/3X/a/0/a0a1c1891acd1f119f4de18a20ccfdc40e48fe40.gif)

---

<div class="post-metadata">

**Author:** ![amca01](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/amca01/32/5853_2.png) [@amca01](https://discourse.julialang.org/u/amca01)\
**Post date:** [January 31, 2020, 5:11am UTC](https://discourse.julialang.org/t/julia-alternative-for-turtle-graphics/31683/6 "2020-01-31T05:11:56Z")

</div>

The image (gif?) of the live turtle drawing of the Peano space filling curve is most impressive. Is the accompanying code available anywhere? (I’m giving a short talk on Lindenmayer systems, and although I can draw a completed structure, it would be fun to show an animation.) Thank you!

---

<div class="post-metadata">

**Author:** ![JeffreySarnoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jeffreysarnoff/32/1980_2.png) [@JeffreySarnoff](https://discourse.julialang.org/u/JeffreySarnoff)\
**Post date:** [January 31, 2020, 5:46am UTC](https://discourse.julialang.org/t/julia-alternative-for-turtle-graphics/31683/7 "2020-01-31T05:46:18Z")

</div>

@cormullion ^

---

<div class="post-metadata">

**Author:** ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Post date:** [January 31, 2020, 9:10am UTC](https://discourse.julialang.org/t/julia-alternative-for-turtle-graphics/31683/8 "2020-01-31T09:10:44Z")

</div>

The code to make that Hilbert curve animation is [here](https://gist.github.com/cormullion/40cca8cc3ad7a315fe2f943dbe832797). This wasn’t done with an L-system like the one [here](http://juliagraphics.github.io/Luxor.jl/latest/turtle/) (although it could have been).

If you suddenly get the urge to jump up and dance to animated Hilbert curves, then you can try watching [this](https://youtu.be/0xeUDXgFMHs). 🙂

---

<div class="post-metadata">

**Author:** ![amca01](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/amca01/32/5853_2.png) [@amca01](https://discourse.julialang.org/u/amca01)\
**Post date:** [January 31, 2020, 10:56pm UTC](https://discourse.julialang.org/t/julia-alternative-for-turtle-graphics/31683/9 "2020-01-31T22:56:12Z")

</div>

Thank you! That YouTube video is quite fantastic. If I can get an animation - even a slow one - running in Luxor, I can save it as a video file of some sort and then speed it up with ffmpeg. I’ve only got a few days to prepare my talk (which is only a short one), and it may be that colour and movement will not be emphasised.
