I am trying to replicate the seasonal plot with the polar axis from this example, but I couldn’t figure out how to replace the degree axis with months. This is the code:

Creating the dataframe

link = "https://vincentarelbundock.github.io/Rdatasets/csv/fpp2/a10.csv"
f = download(link)
a10 = DataFrame(CSV.File(f))
a10.year = parse.( Int64, first.(string.(a10.time),4))
a10.month .= 1
for (i, r) in enumerate(eachrow(a10))
r.month += (i +5) % 12
end

psize = length(unique(a10.year))
f = Figure()
ax =PolarAxis(f[1,1], title = "seasonal plot: " ,theta_0 = -pi/2, direction = -1, )
cbarPal = :thermal
cmap = cgrad(ColorSchemes.colorschemes[:viridis], psize, categorical = true)
x = length(unique(a10.month))
t = a10.month
tnorm = (t.-minimum(t))./(maximum(t).-minimum(t))*2*pi #normalize the axis related to X
a10.month_norm = tnorm #add to the dataframe
list_lin = [] #empty list to use in legend
for (i, value) in enumerate(unique(a10.year))
a10_filtered = filter([:year] => (z) -> z == value , a10)
y = a10_filtered.value
x = a10_filtered.month_norm
lin = lines!(ax ,x, y , label = string(value), color = cmap[i])
push!(list_lin, lin)
end
Legend(f[1, 2], list_lin, string.(minimum(a10.year):maximum(a10.year)))
f

Nice, although something’s still wrong in your code because the data points don’t match the theta locations of the months. Probably an off-by-one error somewhere.

Ah yeah your final point is in January again, while it should be in December

Yeah, it’s another problem that I have to face. In the example, the line is connected, so the transition becomes smooth. However, in my iteration, I am not connecting the points between December and January, which is making that part a bit more confusing for interpretation.