When the yvector is not uniform at each time point, there are problems when drawing the heatmap

I used Makie to create a heatmap graph. The drawn graph has a lot of blank points. I think it might be caused by the fact that the altitude vector is different at each time point. Does anyone know how to deal with this?


What I ultimately want is as shown in the picture below.

Is this really produced by heatmap | Makie? If so – do you mind posting a MWE?

The code and data is as follows:

datetimes = floor(data.st, Hour):Hour(3):ceil(data.se, Hour)
tick_positions =datetime2unix.(datetimes)
tick_labels = Dates.format.(datetimes, "HH:MM")


let
    fig = Figure(; size=(1200, 600))

    ax1 = Axis(fig[1, 1], xlabel="Time UT", ylabel="Altitude (km)",
        title=L"log_{10}(N_e [m^{-3}])",
        xticks=(tick_positions, tick_labels))
    xlims!(ax1, datetime2unix(floor(data.st, Hour)), datetime2unix(ceil(data.se, Hour)))
    ylims!(ax1, 70, 1000)

    heatmap!(ax1, datetime2unix.(tt), al, ne,
        colormap=:jet,
        colorrange=(10, 12))

    Colorbar(fig[1, 2], colormap=:jet, limits=(10, 12))

    fig
end
time,altitude,ne
2025-04-16T23:58:32.0,61.5489501953125,8.46123740339857
2025-04-16T23:58:32.0,65.36458587646484,6.0
2025-04-16T23:58:32.0,69.27091217041016,9.811731143661557
2025-04-16T23:58:32.0,74.56712341308594,9.967771762913046
2025-04-16T23:58:32.0,78.39364624023438,9.397121179304301
2025-04-16T23:58:32.0,82.29679107666016,9.875471469782088
2025-04-16T23:58:32.0,87.58624267578125,10.652210284204585
2025-04-16T23:58:32.0,93.66499328613281,9.915071502284924
2025-04-16T23:58:32.0,97.90210723876953,10.500229397799389
2025-04-16T23:58:32.0,104.59850311279297,10.865671245300838
2025-04-16T23:58:32.0,112.1823959350586,10.977574053799174
2025-04-16T23:58:32.0,120.05602264404297,10.950790662043062
2025-04-16T23:58:32.0,129.22979736328125,10.923193953178949
2025-04-16T23:58:32.0,139.7136688232422,10.934362123919962
2025-04-16T23:58:32.0,150.20567321777344,11.013070688308835
2025-04-16T23:58:32.0,161.792724609375,11.158825171810076
2025-04-16T23:58:32.0,174.91526794433594,11.167914867418292
2025-04-16T23:58:32.0,187.94107055664062,11.307858050285406
2025-04-16T23:58:32.0,202.3780517578125,11.515859715564606
2025-04-16T23:58:32.0,218.07240295410156,11.624994128385572
2025-04-16T23:58:32.0,233.8951416015625,11.82293412053667
2025-04-16T23:58:32.0,250.91709899902344,11.871886971890905
2025-04-16T23:58:32.0,269.3978271484375,11.955362175091125
2025-04-16T23:58:32.0,287.9805603027344,11.97928471562988
2025-04-16T23:58:32.0,307.93145751953125,12.034084381416125
2025-04-16T23:58:32.0,329.02301025390625,11.96806635307268
2025-04-16T23:58:32.0,350.52783203125,11.954381755849933
2025-04-16T23:58:32.0,373.32708740234375,11.929246723626783
2025-04-16T23:58:32.0,397.07147216796875,11.903049702608017
2025-04-16T23:58:32.0,420.90875244140625,11.790443919720476
2025-04-17T00:09:32.0,61.55434036254883,6.0
2025-04-17T00:09:32.0,65.36461639404297,10.356772639015668
2025-04-17T00:09:32.0,69.38404846191406,8.954829911261529
2025-04-17T00:09:32.0,74.51080322265625,8.854358168588206
2025-04-17T00:09:32.0,78.39337158203125,10.058352857592276
2025-04-17T00:09:32.0,82.46529388427734,9.045241940483667
2025-04-17T00:09:32.0,87.64409637451172,10.72009933228049
2025-04-17T00:09:32.0,93.69406127929688,10.580280892212498
2025-04-17T00:09:32.0,97.93019104003906,10.647582856698277
2025-04-17T00:09:32.0,104.54310607910156,10.874121077095438
2025-04-17T00:09:32.0,112.0151138305664,10.950607132920304
2025-04-17T00:09:32.0,120.7859878540039,10.986029097617731
2025-04-17T00:09:32.0,129.07492065429688,10.911377719514629
2025-04-17T00:09:32.0,139.65586853027344,11.016336609608329
2025-04-17T00:09:32.0,150.16624450683594,11.107973628342895
2025-04-17T00:09:32.0,161.82041931152344,11.213050493131759
2025-04-17T00:09:32.0,174.93011474609375,11.305656468384726
2025-04-17T00:09:32.0,187.91815185546875,11.455688422311434
2025-04-17T00:09:32.0,202.29971313476562,11.546995170334538
2025-04-17T00:09:32.0,218.13497924804688,11.717749371865125
2025-04-17T00:09:32.0,233.84820556640625,11.780597224713784
2025-04-17T00:09:32.0,250.95803833007812,11.861154074174088
2025-04-17T00:09:32.0,269.3504333496094,11.966102103231897
2025-04-17T00:09:32.0,287.9954528808594,11.975317263106078
2025-04-17T00:09:32.0,307.8057861328125,12.073463846874471
2025-04-17T00:09:32.0,329.2339172363281,12.044406413762218
2025-04-17T00:09:32.0,350.39776611328125,12.040871779247345
2025-04-17T00:09:32.0,372.95819091796875,12.011116052138636
2025-04-17T00:09:32.0,396.87933349609375,11.92728172010352
2025-04-17T00:09:32.0,420.65936279296875,11.824209193121193
2025-04-17T00:20:33.0,61.63723373413086,7.609990834072022
2025-04-17T00:20:33.0,65.36433410644531,8.905529969753724
2025-04-17T00:20:33.0,69.36307525634766,6.0
2025-04-17T00:20:33.0,74.55867767333984,9.98279956952498
2025-04-17T00:20:33.0,78.39350891113281,9.230481423782907
2025-04-17T00:20:33.0,82.30937957763672,9.824792207055483
2025-04-17T00:20:33.0,87.76779174804688,10.534829735184838
2025-04-17T00:20:33.0,93.55720520019531,10.01891507298412
2025-04-17T00:20:33.0,98.00763702392578,10.44247486831362
2025-04-17T00:20:33.0,104.37483978271484,10.790292067191231
2025-04-17T00:20:33.0,113.00078582763672,11.000198681030927
2025-04-17T00:20:33.0,120.23700714111328,10.919617636155348
2025-04-17T00:20:33.0,129.03607177734375,10.901268299786063
2025-04-17T00:20:33.0,139.89263916015625,11.0005337154339
2025-04-17T00:20:33.0,150.17283630371094,11.117761418534911
2025-04-17T00:20:33.0,161.96981811523438,11.145928661162355
2025-04-17T00:20:33.0,174.99896240234375,11.270010281544575
2025-04-17T00:20:33.0,188.08094787597656,11.426398579138722
2025-04-17T00:20:33.0,202.307861328125,11.50362771368949
2025-04-17T00:20:33.0,218.18032836914062,11.64060016490513
2025-04-17T00:20:33.0,233.8591766357422,11.751141565132135
2025-04-17T00:20:33.0,250.90953063964844,11.831956502243818
2025-04-17T00:20:33.0,269.3108825683594,11.9268097271308
2025-04-17T00:20:33.0,287.7954406738281,11.966549888470563
2025-04-17T00:20:33.0,307.8033752441406,12.040004425574471
2025-04-17T00:20:33.0,329.0226135253906,12.07436475838484
2025-04-17T00:20:33.0,350.211669921875,12.037377402836247
2025-04-17T00:20:33.0,372.9463806152344,12.012669357158613
2025-04-17T00:20:33.0,396.887451171875,11.932096299410135
2025-04-17T00:20:33.0,420.80291748046875,11.904883745807293
2025-04-17T00:31:34.0,61.575775146484375,8.384178384902434
2025-04-17T00:31:34.0,65.36470031738281,8.722326122424867
2025-04-17T00:31:34.0,69.2958984375,9.948107515719666
2025-04-17T00:31:34.0,74.62100982666016,9.680999632964948
2025-04-17T00:31:34.0,78.39344024658203,9.834926242987837
2025-04-17T00:31:34.0,82.38230895996094,9.755941421667147
2025-04-17T00:31:34.0,87.64270782470703,10.495029008509734
2025-04-17T00:31:34.0,93.68094635009766,10.06774611951658
2025-04-17T00:31:34.0,97.51851654052734,10.609557805898696
2025-04-17T00:31:34.0,104.40958404541016,10.90701708945975
2025-04-17T00:31:34.0,112.21839904785156,11.01061871601158
2025-04-17T00:31:34.0,120.15837097167969,10.96021630190543
2025-04-17T00:31:34.0,129.19456481933594,10.962918143406698
2025-04-17T00:31:34.0,139.7174835205078,11.026007444356967
2025-04-17T00:31:34.0,150.13124084472656,11.138363292769322
2025-04-17T00:31:34.0,161.9260711669922,11.248206782041938
2025-04-17T00:31:34.0,174.93443298339844,11.301082460271367
2025-04-17T00:31:34.0,188.06637573242188,11.42634486265452
2025-04-17T00:31:34.0,202.44970703125,11.516746234903621
2025-04-17T00:31:34.0,218.12110900878906,11.62431804727906
2025-04-17T00:31:34.0,233.84861755371094,11.74064669915975
2025-04-17T00:31:34.0,250.9377899169922,11.80452893874917
2025-04-17T00:31:34.0,269.1885681152344,11.94281849598754
2025-04-17T00:31:34.0,287.9707336425781,11.946401245266708
2025-04-17T00:31:34.0,307.7417907714844,11.993931525619011
2025-04-17T00:31:34.0,328.890380859375,12.023838771539207
2025-04-17T00:31:34.0,350.1716003417969,12.0758597150223
2025-04-17T00:31:34.0,372.6962890625,12.072815685413131
2025-04-17T00:31:34.0,396.6961669921875,11.994584076203417
2025-04-17T00:31:34.0,420.5193176269531,11.938181463659244

The positions where the values are unspecified are treated as if they contained NaN. That’s why you see the blank points.

I don’t think Makie’s heatmap supports interpolation out-of-box, so you probably have to interpolate the missing values yourself (e.g., https://stackoverflow.com/questions/68556256/2d-interpolation-in-julia).

You could also try tricontourf | Makie.

1 Like