Plots with log or symlog scale

aplavin
Sat, 06 Oct 2018 09:47:47 +0000
Visualization

I’m trying to make plots with log and symlog scales, but no success with Plots.jl so far. When I try cgrad(scale=:log) it gives strange results, see below. And there seem to be no other place to specify log-scale.

A = randn(50, 100)
heatmap(log10.(abs.(A)), color=cgrad(:RdBu))
gives

which has correct colors, but of course wrong color scale: I need it to show original values instead of logs.
With scale=:log:
heatmap(abs.(A), color=cgrad(:RdBu, scale=:log))

I totally don’t get how it computes colors here. And also I don’t find anything related to symlog scale.

For comparison, using PyPlot:

imshow(log.(abs.(A)), cmap=:RdBu)
colorbar()

The same result as with Plots.
With log-scale:

imshow(abs.(A), cmap=:RdBu, norm=matplotlib[:colors][:LogNorm]())
colorbar()

This is the correct way to show log-scale plot.
And finally, symlog:

imshow(A, cmap=:RdBu, norm=matplotlib[:colors][:SymLogNorm](1e-2))
colorbar()

Is there a way to reproduce the last two plots (which use PyPlot) with Plots and non-pyplot backend?

6 posts - 5 participants