Select color range for heatmap

vamp
Tue, 24 May 2022 14:00:55 +0000
New to Julia

Hello,

I want to plot the values of a “big” matrix using plots. The matrix is on a .txt file and I do the following:

using DelimitedFiles, Plots, LinearAlgebra, Pyplot
writedlm( "MyFile.txt",  values, ' ')
t1 = readdlm("MyFile.txt")
t2 = heatmap(t1 , xlabel="X", ylabel="Y",title = "Title", yflip=true,  axis=false, c =:ocean)
savefig(t2,"MyFigure.svg")

When I use c =:ocean it selects the color using linear interpolation. How can I define for example:

If value is between 0 and 10 red.

If value is between 10 and 100 blue.

If value is between 100 and 1000 purple.

Thanks!

6 posts - 2 participants