Set custom colorbar tick-labels

Everything is possible, with some imagination:

using Plots; gr()
using Measures, Plots; gr()

n = 5
z = rand(10,10)
clrticks = ["C$i" for i in 1:n]
yt = range(0,1,n+1)[1:n] .+ 0.5/n

l = @layout [ a{0.80w} [b{0.1h}; c] ]
colors = cgrad(:inferno, n, categorical=true)
p1 = heatmap(z, color=colors,  cbar=false);
p2 = plot([NaN], lims=(0,1), framestyle=:none, legend=false);
annotate!(0.5, -0.1, text("Colors", 10, "Computer Modern"))
xx = range(0,1,100)
zz = zero(xx)' .+ xx
p3 = heatmap(xx, xx, zz, ticks=false, ratio=10, legend=false, fc=colors, lims=(0,1),
             framestyle=:box, right_margin=20mm);
[annotate!(1.5, yi, text(ti, 7, "Computer Modern")) for (yi,ti) in zip(yt,clrticks)]
plot(p1, p2, p3, layout=l, margins=0mm)
2 Likes