No heatmap interpolation in CairoMakie?

I am trying to plot a heatmap with color interpolation, but I can’t seem to do it. I tried do it using the example from the Makie website

using CairoMakie

xs = range(0, 10, length = 25)
ys = range(0, 15, length = 25)
zs = [cos(x) * sin(y) for x in xs, y in ys]

heatmap(xs, ys, zs, interpolate=true)

but I get an identical plot as the example:

What am I doing wrong? I’m using CairoMakie v0.6.2.

This seems to be a regression. To be honest, the filtering behavior of Cairo is a bit weird, you get inconsistent results between bitmap and vector backends. It seems that currently FILTER_BEST is set for bitmap backends, but this doesn’t actually blur anything and looks like FILTER_NEAREST (your example). FILTER_BILINEAR seems to blur in both vector and bitmap backends. But FILTER_NEAREST does blur in vector backends. (That’s due to pdf/svg renderer implementations though). So I think the value should be reset to FILTER_BILINEAR for interpolation.

1 Like

How to do that actually? Where do you reset to FILTER_BILINEAR ?

I think that’s only done in the Makie internals, but it should work by default now after this fix. At least the code in the top post works for me know.

1 Like