I just did the exact same as the example then i got it working and then changed it to you example.
using PyPlot fig, ax = subplots() data = pi*rand(10, 10) cax = ax[:imshow](data,vmin=0, vmax=pi) cbar = fig[:colorbar](cax, ticks=[0, pi]) cbar[:ax][:set_yticklabels]([ "0", "\$\\pi\$"])
