# How to plot heatmap and contour plots in polar coordinates with Plots.jl?

#1

It is really nice to have polar coordinates implemented in Plots.jl:

``````using Plots; gr()

plot(linspace(0,3π,100), rand(100), proj=:polar, m=:red)
``````

and even nicer to interact with them using the PlotlyJS backend. However, I can’t find documentation on how to plot heatmaps and contour plots in polar coordinates. Could you please give a hand?

#2

This works with `pyplot()` but almost no other backend:

``````pyplot()
r = linspace(0,10,11)
θ = linspace(0,360,361)
f(r,θ) = r^2
hm = heatmap(f.(r,θ'), aspect_ratio=:equal, proj=:polar, legend=false)
``````

#3

Thank you @mohamed82008 that is very helpful already. Also, nice trick with dot syntax and transposing theta.

#4

Not mine got it from Steven https://github.com/stevengj/18S096-iap17/blob/master/lecture6/Numerical-Analysis.ipynb. There are also nice contour plots near the end of that notebook with PyPlot.jl.

#5

indeed, very nice trick. thanks, m and s.