Formatting the x-axis with hex values

To also handle negative numbers:

using Plots

p = histogram(randn(1000)*10, bins=:scott, weights=repeat(1:5, outer=200))
xt = round.(Int, xticks(p)[1][1])
xticks!(xt, @. ifelse(xt ≥ 0, "0x", "-0x") * string(abs(xt),base=16,pad=2))

2 Likes