# Makie: cannot plot with symlog colorscale

**URL:** <https://discourse.julialang.org/t/makie-cannot-plot-with-symlog-colorscale/113043>\
**Category:** General Usage\
**Created:** [April 17, 2024, 1:52am UTC](https://discourse.julialang.org/t/makie-cannot-plot-with-symlog-colorscale/113043 "2024-04-17T01:52:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![aplavin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aplavin/32/222056_2.png) [@aplavin](https://discourse.julialang.org/u/aplavin)\
**Post date:** [April 17, 2024, 1:52am UTC](https://discourse.julialang.org/t/makie-cannot-plot-with-symlog-colorscale/113043/1 "2024-04-17T01:52:00Z")

</div>

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:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/f/0/f01f51f81ce0297e74e5fb5503a96d1ac76aeb72.png)

And this is what I expected it to be (result from matplotlib for the same array):  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/f/9/f9de7015386c5c9fa5c934d82e194896553af433.png)

Full code for both:

```julia
# 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?

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [April 17, 2024, 5:32am UTC](https://discourse.julialang.org/t/makie-cannot-plot-with-symlog-colorscale/113043/2 "2024-04-17T05:32:35Z")

</div>

That does look very weird, mind opening an issue?

---

<div class="post-metadata">

**Author:** ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Post date:** [April 17, 2024, 6:03am UTC](https://discourse.julialang.org/t/makie-cannot-plot-with-symlog-colorscale/113043/3 "2024-04-17T06:03:21Z")

</div>

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`](https://docs.makie.org/stable/reference/plots/image/#examples) 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.

---

<div class="post-metadata">

**Author:** ![ederag](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ederag/32/4106_2.png) [@ederag](https://discourse.julialang.org/u/ederag)\
**Post date:** [April 17, 2024, 9:10am UTC](https://discourse.julialang.org/t/makie-cannot-plot-with-symlog-colorscale/113043/4 "2024-04-17T09:10:06Z")

</div>

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

This [summary](https://github.com/MakieOrg/Makie.jl/issues/205#issuecomment-473782431) about the orientation rationale seems relevant ?

---

<div class="post-metadata">

**Author:** ![aplavin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aplavin/32/222056_2.png) [@aplavin](https://discourse.julialang.org/u/aplavin)\
**Post date:** [April 17, 2024, 11:09am UTC](https://discourse.julialang.org/t/makie-cannot-plot-with-symlog-colorscale/113043/5 "2024-04-17T11:09:34Z")

</div>

> [@TheLateKronos](#):
>
> 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”

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.

---

<div class="post-metadata">

**Author:** ![aplavin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aplavin/32/222056_2.png) [@aplavin](https://discourse.julialang.org/u/aplavin)\
**Post date:** [April 17, 2024, 12:46pm UTC](https://discourse.julialang.org/t/makie-cannot-plot-with-symlog-colorscale/113043/6 "2024-04-17T12:46:24Z")

</div>

> [@jules](#):
>
> That does look very weird, mind opening an issue?

> <https://github.com/MakieOrg/Makie.jl/issues/3788>
>
> I’m trying to plot a 2d array with both positive an negative values, using a “sy…mlog” colorscale in Makie.
> 
> This is what I get, looks weird – I cannot make any sense out of colorbar labels:
> !\[\](https://global.discourse-cdn.com/julialang/original/3X/f/0/f01f51f81ce0297e74e5fb5503a96d1ac76aeb72.png)
> 
> And this is what I expected it to be – result from matplotlib for the same array for comparison:
> !\[\](https://global.discourse-cdn.com/julialang/original/3X/f/9/f9de7015386c5c9fa5c934d82e194896553af433.png)
> 
> My issue here is with the colorscale specifically, not any other visual difference between Makie and matplotlib.
> 
> Full code for both:
> \`\`\`julia
> \# 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
> \`\`\`
> 
> 
> \- \[x\] are you running newest version (version from docs) ? – yes
> \- \[x\] can you reproduce the bug with a fresh environment ? (\`\]activate --temp; add Makie\`) – yes
> \- \[x\] What platform + GPU are you on? – Any backend, same result.
