# Simpler Yin-Yang?

**URL:** <https://discourse.julialang.org/t/simpler-yin-yang/134696>\
**Category:** Visualization\
**Tags:** luxor\
**Created:** [December 22, 2025, 6:55pm UTC](https://discourse.julialang.org/t/simpler-yin-yang/134696 "2025-12-22T18:55:05Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![tp2750](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tp2750/32/207806_2.png) [@tp2750](https://discourse.julialang.org/u/tp2750)\
**Post date:** [December 22, 2025, 6:55pm UTC](https://discourse.julialang.org/t/simpler-yin-yang/134696/1 "2025-12-22T18:55:05Z")

</div>

I wanted to draw the Yin-Yang symbol in Luxor.jl.  
Here’s what I came up with. Can this be done more idiomatic?  
I would have preferred the white “eye” of the black “fish” to be just a cut-out rather than over-plotting with white. However, I was not able to figure out how.

```julia-auto
using Luxor
R = 128
@png begin
    move(Point(0,-R)) # start at top
    arc(Point(0,0), R, -pi/2, pi/2, :path) # right side arc to bottom
    arc(Point(0,R/2), R/2, pi/2, -pi/2, :path) # small arc up
    carc(Point(0,-R/2), R/2, pi/2, -pi/2,:path) # small arc counter-clockwise
    fillpath()
    circle(Point(0,0), R, action=:stroke) # large circle
    circle(Point(0,-R/2), R/8, action=:fill) # white fish eye
    sethue("white")
    circle(Point(0,R/2), R/8, action=:fill) # black fish eye
end 

```

 ![ying-yang](https://global.discourse-cdn.com/julialang/original/3X/e/5/e5e42cf7ff1e455331aee2e0fd56b329c88a0fe8.png)

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [December 22, 2025, 9:12pm UTC](https://discourse.julialang.org/t/simpler-yin-yang/134696/2 "2025-12-22T21:12:58Z")

</div>

My eye doesn’t like the discontinuity in the second derivative that arises when you glue two arcs together. Maybe a spline would be better?

---

<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:** [December 22, 2025, 10:27pm UTC](https://discourse.julialang.org/t/simpler-yin-yang/134696/3 "2025-12-22T22:27:30Z")

</div>

Your version is fine. You could add a circular hole as a subpath of the shape:

```julia
R = 220
function y()
    arc(O, R, 0, π)
    arc(O - (R/2, 0), R/2, π, 0)
    carc(O + (R/2, 0), R/2, π, 0)
    newsubpath()
    circlepath(O - (R/2, 0), R/5, reversepath=false)
end

@draw begin
    background("maroon")
    for i in 1:2
        sethue(["black", "white"][i])
        y()
        fillpath()
        rotate(π)
    end
end

```

 ![Screenshot 2025-12-22 at 22.24.41](https://global.discourse-cdn.com/julialang/original/3X/9/7/97a087b6047b4aa94361eb926f379996a43f203b.png)

But I can’t think of a way to smooth out that jump from one semicircle to the next…

---

<div class="post-metadata">

**Author:** ![tp2750](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tp2750/32/207806_2.png) [@tp2750](https://discourse.julialang.org/u/tp2750)\
**Post date:** [December 23, 2025, 6:04am UTC](https://discourse.julialang.org/t/simpler-yin-yang/134696/4 "2025-12-23T06:04:52Z")

</div>

Thank you @cormullion - and thank you for all your work on Luxor.jl!

Do you have a reference for the R/5 radius of the “fish eye”?  
I found references for R/8 and R/6:

- R/8: [Taiji variations: Yin and Yang in multiple dimensions - ScienceDirect](https://www.sciencedirect.com/science/article/abs/pii/S0097849306002263) (but also saying “this eye radius is a somewhat arbitrary value and may vary according to the designer’s preference”)
- R/6: [Reddit - The heart of the internet](https://www.reddit.com/r/SacredGeometry/comments/11bqgqp/mathematical_precision_of_yin_yang_symbol/)

Is this too simple to add to the [Examples](https://juliagraphics.github.io/LuxorManual/stable/example/examples/)? I see now that there is an example of `circlepath` just above [Draw simple shapes · Luxor](https://juliagraphics.github.io/LuxorManual/stable/howto/simplegraphics/#Circles-and-tangents), so it may be redundant. I’ll be happy to do a PR.

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [December 23, 2025, 8:55am UTC](https://discourse.julialang.org/t/simpler-yin-yang/134696/5 "2025-12-23T08:55:04Z")

</div>

> [@cormullion](#):
>
> I can’t think of a way to smooth out that jump from one semicircle to the next

I must admit that I never used Luxor, but in Plots.jl this issue is minimised by asking the bounding lines to be transparent:

```julia
using Plots: plot, plot!, partialcircle as pc

R, n = 1.0, 1000
plot(pc(-pi/2, pi/2, n, R), ratio=1, fill=true, c=:black, legend=false)
plot!(map(x -> (0, -R/2) .+ x, pc(0, 2pi, n, R/2)), lc=:transparent, fill=true, c=:black, legend=false)
plot!(map(x -> (0, R/2) .+ x, pc(0, 2pi, n, R/2)), lc=:transparent, fill=true, c=:white, legend=false)
plot!(map(x -> (0, -R/2) .+ x, pc(0, 2pi, n, R/8)), lc=:transparent, fill=true, c=:white, legend=false)
plot!(map(x -> (0, R/2) .+ x, pc(0, 2pi, n, R/8)), lc=:transparent, fill=true, c=:black, legend=false)
plot!(pc(0, 2pi, n, R), lw=3, fill=false, c=:black, legend=false, ticks=false, showaxis=false)

```

 ![Plots_gr_Yin-Yang](https://global.discourse-cdn.com/julialang/original/3X/9/4/94b6f4fc3c021875a7bab91b05f4e3c0130fddff.svg)

---

<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:** [December 23, 2025, 9:48am UTC](https://discourse.julialang.org/t/simpler-yin-yang/134696/6 "2025-12-23T09:48:52Z")

</div>

> Do you have a reference for the R/5 radius of the “fish eye”?

Just thought it looked OK - small holes can get filled in sometimes (like in fonts 🙂 )

> Do you have a reference for the R/5 radius of the “fish eye”?  
> I found references for R/8 and R/6:

haha I didn’t think to look “in the literature”

> I’ll be happy to do a PR.

Always welcome!

Looking at the transition:

```Julia
@draw begin
    arc(O - (R/2, 0), R/2, π, 0)
    carc(O + (R/2, 0), R/2, π, 0)
    strokepath()
    arc(O - (R/2, 0), R/2, π, 0)
    carc(O + (R/2, 0), R/2, π, 0)
    for bp in pathtobezierpaths()
        for bps in bp
            @layer begin
                randomhue()
                circle.(bps, 5, :fill)
            end
            arrow(bps[1], bps[2])
            arrow(bps[4], bps[3])
        end
    end
end

```

 ![Screenshot 2025-12-23 at 09.46.24](https://global.discourse-cdn.com/julialang/original/3X/5/5/5522fcc76c88cae445cbfa2c1079109d8ceb93d6.png)

Some way of moving the two central Bezier control points away from the vertical …🤔

---

<div class="post-metadata">

**Author:** ![tp2750](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tp2750/32/207806_2.png) [@tp2750](https://discourse.julialang.org/u/tp2750)\
**Post date:** [December 24, 2025, 7:48am UTC](https://discourse.julialang.org/t/simpler-yin-yang/134696/7 "2025-12-24T07:48:08Z")

</div>

Thanks @rafael.guerra . I had no idea Plots.jl could do this.
