MakieOrg / GeoMakie.jl

Geographical plotting utilities for Makie.jl
https://geo.makie.org
MIT License
167 stars 24 forks source link

Plot limits do not set automatically when `-Inf` values are present #238

Closed nchisholm closed 3 months ago

nchisholm commented 3 months ago

Using GeoMakie 0.6.5, I found that GeoAxis limits fail to set automatically if there are one or more -Inf values present in the data being plotted. +Inf, NaN, or missing values do not trigger the issue. I tried heatmap using CairoMakie and surface using GLMakie with similar results.

using GLMakie, GeoMakie

fig = Figure()
ga = GeoAxis(fig[1, 1])

lons = -180:180
lats = -90:90
z = [exp(cosd(l)) + 3(y/90) for l in lons, y in lats]

# One or more values to `-Inf`
@. z[-3 < lons < 3, -3 < lats < 3] = -Inf

hm = surface!(ga, lons, lats, z; shading=NoShading, interpolate=false)

Result: map

If I change -Inf to Inf or NaN, I get what I expect. map-expected

asinghvi17 commented 3 months ago

This shouldn't be an issue on master and Makie v0.21 - am away from my laptop but will confirm later.

asinghvi17 commented 3 months ago

This displays correctly on master, with both CairoMakie and GLMakie in png mode: download-2

CairoMakie in PDF is also fine, but SVG has some weird artefacts depending on which renderer you use. That can't be helped there, though.

If you want to use GeoMakie master,

using Pkg
Pkg.add(name = "GeoMakie", rev = "master") 

ought to do it. Just remember to Pkg.free("GeoMakie") later.