# How do I do a plot in spherical coordinates?

**URL:** <https://discourse.julialang.org/t/how-do-i-do-a-plot-in-spherical-coordinates/96583>\
**Category:** Visualization\
**Created:** [March 25, 2023, 2:34am UTC](https://discourse.julialang.org/t/how-do-i-do-a-plot-in-spherical-coordinates/96583 "2023-03-25T02:34:56Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![rmfritz](https://avatars.discourse-cdn.com/v4/letter/r/b487fb/32.png) [@rmfritz](https://discourse.julialang.org/u/rmfritz)\
**Post date:** [March 25, 2023, 2:34am UTC](https://discourse.julialang.org/t/how-do-i-do-a-plot-in-spherical-coordinates/96583/1 "2023-03-25T02:34:56Z")

</div>

I either want to see a 3D surface or web of points. I suppose I can just take the 3D surface example as a model, but if possible, I would like to have angle axes. Is that possible with existing graphics libraries?

---

<div class="post-metadata">

**Author:** ![jd-foster](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jd-foster/32/35824_2.png) [@jd-foster](https://discourse.julialang.org/u/jd-foster)\
**Post date:** [March 25, 2023, 10:47am UTC](https://discourse.julialang.org/t/how-do-i-do-a-plot-in-spherical-coordinates/96583/2 "2023-03-25T10:47:58Z")

</div>

You might be interested in using Plotly via the PlotlyJS.jl package.

@empet has a great gallery of 3D examples: **[3D-Viz-with-PlotlyJS.jl](https://github.com/empet/3D-Viz-with-PlotlyJS.jl)**

and has contributed to this discussion on the plotly forum (based on the python plotly) that seems related to your question:

> **[Can I do Scatter3d in spherical coordinates?](https://community.plotly.com/t/can-i-do-scatter3d-in-spherical-coordinates/60535)**
>
> Hi, I have succesfully made a light cone plot (kind of a wedge plot) in polar coordinates with this code: fig = px.scatter\_polar(df\_rdwz, r='z', theta='ra', range\_theta=\[-6,6\], range\_r=\[0.8,3.2\], start\_angle=0,...

---

<div class="post-metadata">

**Author:** ![dlfivefifty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dlfivefifty/32/1959_2.png) [@dlfivefifty](https://discourse.julialang.org/u/dlfivefifty)\
**Post date:** [March 25, 2023, 2:12pm UTC](https://discourse.julialang.org/t/how-do-i-do-a-plot-in-spherical-coordinates/96583/3 "2023-03-25T14:12:17Z")

</div>

> **[Tesseral Spherical Harmonics - Beautiful Makie](https://beautiful.makie.org/dev/examples/generated/2d/surfaces/tesseralSphericalH/)**
>
> Makie Examples

---

<div class="post-metadata">

**Author:** ![rmfritz](https://avatars.discourse-cdn.com/v4/letter/r/b487fb/32.png) [@rmfritz](https://discourse.julialang.org/u/rmfritz)\
**Post date:** [March 25, 2023, 11:06pm UTC](https://discourse.julialang.org/t/how-do-i-do-a-plot-in-spherical-coordinates/96583/4 "2023-03-25T23:06:07Z")

</div>

Thanks. I can see I have work ahead of me.

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [March 25, 2023, 11:20pm UTC](https://discourse.julialang.org/t/how-do-i-do-a-plot-in-spherical-coordinates/96583/5 "2023-03-25T23:20:44Z")

</div>

Earth is often represented in spherical coordinates. [GMT.jl](https://github.com/GenericMappingTools/GMT.jl) has lots of tools for those representations, maybe some will suit your needs.

---

<div class="post-metadata">

**Author:** ![rmfritz](https://avatars.discourse-cdn.com/v4/letter/r/b487fb/32.png) [@rmfritz](https://discourse.julialang.org/u/rmfritz)\
**Post date:** [March 25, 2023, 11:25pm UTC](https://discourse.julialang.org/t/how-do-i-do-a-plot-in-spherical-coordinates/96583/6 "2023-03-25T23:25:04Z")

</div>

Oh, good idea.

---

<div class="post-metadata">

**Author:** ![rmfritz](https://avatars.discourse-cdn.com/v4/letter/r/b487fb/32.png) [@rmfritz](https://discourse.julialang.org/u/rmfritz)\
**Post date:** [March 28, 2023, 9:15pm UTC](https://discourse.julialang.org/t/how-do-i-do-a-plot-in-spherical-coordinates/96583/7 "2023-03-28T21:15:12Z")

</div>

If anyone wants to know what I did about this, I hacked it - fed the point coordinates into a CAD program (Rhino) which accepts spherical coordinates in input. Maybe some other time I’ll do proper Julia code, but this was quick, and enough. (And I can use Rhino to create just about any reasonable visualization of the data.)

I am still surprised that support for spherical coordinates is so thin; they are widely used in physics, engineering, and geography.

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [March 28, 2023, 10:45pm UTC](https://discourse.julialang.org/t/how-do-i-do-a-plot-in-spherical-coordinates/96583/8 "2023-03-28T22:45:36Z")

</div>

> [@rmfritz](#):
>
> is so thin; they are widely used in …, and geography.

GMT, thin???
