# How to plot a curvilinear domain using Plots?

**URL:** <https://discourse.julialang.org/t/how-to-plot-a-curvilinear-domain-using-plots/111804>\
**Category:** Visualization\
**Tags:** package, pyplot, plots\
**Created:** [March 19, 2024, 7:36am UTC](https://discourse.julialang.org/t/how-to-plot-a-curvilinear-domain-using-plots/111804 "2024-03-19T07:36:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![arturofburgos](https://avatars.discourse-cdn.com/v4/letter/a/90db22/32.png) [@arturofburgos](https://discourse.julialang.org/u/arturofburgos)\
**Post date:** [March 19, 2024, 7:36am UTC](https://discourse.julialang.org/t/how-to-plot-a-curvilinear-domain-using-plots/111804/1 "2024-03-19T07:36:31Z")

</div>

Hello Everyone,

I have been trying to create the same plot here that I created using PyPlot, but now using Plots. Does anyone know how to work around this issue?

```julia
using PyPlot
# ion()
# pygui(true)

r_ini = 1.0
r_end = 2.0 # range in r-direction
θ_ini = 0.0
θ_end = π/2 # range in θ-direction
n = 31

# Spatial grid for the numerical solution 
r = range(r_ini, stop=r_end, length=n)
θ = range(θ_ini, stop=θ_end, length=n)'

x1 = r .* cos.(θ)
y1 = r .* sin.(θ)
z = ones(size(x1))

contourf(x1, y1, z', title="Initial Condition", color=:viridis)
#contourf(r, θ', z, title="Initial Condition", color=:viridis)

display(gcf())

```

![image](https://global.discourse-cdn.com/julialang/original/3X/9/a/9a5528e7ad4ce0412f76cba92a5ef8ce2a4b1f79.png)

Now with Plots:

```julia
using Plots

r_ini = 1.0
r_end = 2.0 # range in r-direction
θ_ini = 0.0
θ_end = π/2 # range in θ-direction
n = 100

# Spatial grid for the numerical solution 
r = range(r_ini, stop=r_end, length=n)
θ = range(θ_ini, stop=θ_end, length=n)

x1 = r .* cos.(θ)
y1 = r .* sin.(θ)
z = ones(n, n) # Ensure z has the correct dimensions

contourf(x1, y1, z, title="Initial Condition", color=:viridis)

```

![image](https://global.discourse-cdn.com/julialang/original/3X/7/7/77bdabb3b2327a11fd633126942707e850dfb4b3.png)

Also it shows in the REPL that either “Arrays have incorrect length or dimension.” or “points not sorted in ascending order”.

Can someone help me with this? Thanks in advance!

---

<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:** [March 19, 2024, 1:29pm UTC](https://discourse.julialang.org/t/how-to-plot-a-curvilinear-domain-using-plots/111804/2 "2024-03-19T13:29:17Z")

</div>

It works using Plots’ `pyplot()` backend.

---

<div class="post-metadata">

**Author:** ![arturofburgos](https://avatars.discourse-cdn.com/v4/letter/a/90db22/32.png) [@arturofburgos](https://discourse.julialang.org/u/arturofburgos)\
**Post date:** [March 19, 2024, 3:39pm UTC](https://discourse.julialang.org/t/how-to-plot-a-curvilinear-domain-using-plots/111804/3 "2024-03-19T15:39:58Z")

</div>

Thanks @rafael.guerra !
