Makie: cannot plot with symlog colorscale

I’m trying to plot a 2d array with both positive an negative values, using a “symlog” colorscale in Makie.

This is what I get, looks weird – I cannot make any sense out of colorbar labels:

And this is what I expected it to be (result from matplotlib for the same array):
image

Full code for both:

# Makie:
let
	fig, ax, plt = image(A, colorscale=Makie.Symlog10(0.1), interpolate=false, colormap=:viridis)
	Colorbar(fig[1,2], plt)
	fig
end

# PyPlot:
let
	plt.figure()
	plt.imshow(A, norm=matplotlib.colors.SymLogNorm(0.1))
	plt.colorbar()
	plt.gcf()
end

How to make a reasonable symlog colorscale?

1 Like

That does look very weird, mind opening an issue?

One issue I believe is at play here is that for for Makie’s image, the first dimension of the plotted array is currently along the x-dimension (to the right in a normal plot), despite the first dimension of an array usually being imagined as moving “down”. This is also why the examples for image have to use rotr90, or transpose+reverse y-axis, to orient the image correctly.

I expected image to do this automatically, and heatmap to behave as described above. I believe I raised this in some issue somewhere, but I was unable to find it again.

I believe I raised this in some issue somewhere, but I was unable to find it again.

This summary about the orientation rationale seems relevant ?

Yeah, I noticed it, and at least in my usecases it makes more sense: first dim goes along x, second along y. I routinely have to use transposition for matplotlib imshow (:

Anyway, that’s orthogonal to the colorscale question I’m asking here.

3 Likes