# \[ANN\] ComplexValues, ComplexRegions, and ComplexPlots

**URL:** <https://discourse.julialang.org/t/ann-complexvalues-complexregions-and-complexplots/103556>\
**Category:** Package Announcements\
**Created:** [September 5, 2023, 10:21pm UTC](https://discourse.julialang.org/t/ann-complexvalues-complexregions-and-complexplots/103556 "2023-09-05T22:21:16Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tobydriscoll](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tobydriscoll/32/1843_2.png) [@tobydriscoll](https://discourse.julialang.org/u/tobydriscoll)\
**Post date:** [September 5, 2023, 10:21pm UTC](https://discourse.julialang.org/t/ann-complexvalues-complexregions-and-complexplots/103556/1 "2023-09-05T22:21:16Z")

</div>

I’m pleased to announce updates to two packages and a new third one for working in the complex plane:

- [ComplexValues](https://github.com/complexvariables/ComplexValues.jl) (update), which defines polar and spherical representations of complex numbers;
- [ComplexRegions](https://github.com/complexvariables/ComplexRegions.jl) (update), which defines tools for working with curves, paths, and regions in the complex plane; and
- [ComplexPlots](https://github.com/complexvariables/ComplexPlots.jl) (new), which provides for plots on the Riemann sphere and using phase/amplitude coloring.

For example,

```julia
z = [complex(2cospi(t), 0.5sinpi(t)) for t in (0:400) / 200]
plot(Spherical.(z), l=3, label="ellipse")
plot!(Spherical(Line(0, 1im)), l=3, label="line")

```

![temp](https://global.discourse-cdn.com/julialang/original/3X/f/5/f57fd3be6e2480950e2a58152a5d2edda4a595b1.png)

```julia
zplot(z -> (z^3 - 1) / (3im - z)^2)

```

 ![](https://global.discourse-cdn.com/julialang/original/3X/2/0/206300df9f174cee63007039b49cb373e4e06838.png)

The last of these quite accidentally overlaps with the recent beautiful [DomainColoring](https://github.com/eprovst/DomainColoring.jl) package. The latter has a few more features, but ComplexPlots works with Plots.jl as well as with Makie,jl.

---

<div class="post-metadata">

**Author:** ![empet](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/empet/32/221303_2.png) [@empet](https://discourse.julialang.org/u/empet)\
**Post date:** [September 6, 2023, 9:14pm UTC](https://discourse.julialang.org/t/ann-complexvalues-complexregions-and-complexplots/103556/2 "2023-09-06T21:14:35Z")

</div>

The next step, Riemann surfaces: [https://nbviewer.org/gist/empet/12d851d54ce39a86fa61ce7dea6720ec](https://nbviewer.org/gist/empet/12d851d54ce39a86fa61ce7dea6720ec)

---

<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:** [September 6, 2023, 9:36pm UTC](https://discourse.julialang.org/t/ann-complexvalues-complexregions-and-complexplots/103556/3 "2023-09-06T21:36:32Z")

</div>

> [@tobydriscoll](#):
>
> [ComplexPlots](https://github.com/complexvariables/ComplexPlots.jl) (new), which provides for plots on the Riemann sphere and using phase/amplitude coloring.

It looks like you use the complex number type to dispatch with `plot`. Wouldn’t it be nice to accept an ordinary `Complex` array and then simply have different plot functions (`polarplot` etc), or different keyword arguments? Why require users to convert their complex arrays to new types just to plot them differently?

---

<div class="post-metadata">

**Author:** ![tobydriscoll](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tobydriscoll/32/1843_2.png) [@tobydriscoll](https://discourse.julialang.org/u/tobydriscoll)\
**Post date:** [September 7, 2023, 12:04am UTC](https://discourse.julialang.org/t/ann-complexvalues-complexregions-and-complexplots/103556/4 "2023-09-07T00:04:17Z")

</div>

Another point of view is that I just want to `plot` a thing in whatever way is most natural for the thing, rather than having to remember new commands or keywords. The real answer is that I was thinking about the types themselves before I thought about how to plot them, so this came about as a natural progression in Plots.

I would not object to having dedicated plot command names. For Makie that route is actually much easier to implement, since recipes don’t seem to allow manipulating the axes or figures. I guess then you offend the “only one way to do things” crowd, though.

---

<div class="post-metadata">

**Author:** ![tobydriscoll](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tobydriscoll/32/1843_2.png) [@tobydriscoll](https://discourse.julialang.org/u/tobydriscoll)\
**Post date:** [September 7, 2023, 12:05am UTC](https://discourse.julialang.org/t/ann-complexvalues-complexregions-and-complexplots/103556/5 "2023-09-07T00:05:08Z")

</div>

👀

---

<div class="post-metadata">

**Author:** ![eprovst](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/eprovst/32/50943_2.png) [@eprovst](https://discourse.julialang.org/u/eprovst)\
**Post date:** [September 19, 2023, 7:44pm UTC](https://discourse.julialang.org/t/ann-complexvalues-complexregions-and-complexplots/103556/7 "2023-09-19T19:44:00Z")

</div>

Always nice to see other people are working on complex visualisations as well (author of DomainColoring here)!

The type first approach is interesting to see, and as it’s all Plots.jl/Makie (thanks to ComplexPlots for helping me figure out how to support both) in the background, our packages seem to interoperate quite nicely. Cool stuff 🙂
