Hi!
Is there a way in the existing API to include a colorbar “inside” an existing axis. Like in the attached image?
Source of uncropped image:
using Plots
function f(x, y)
r = sqrt(x^2 + y^2)
return cos(r) / (1 + r)
end
x = range(0, 2π, length = 30)
heatmap(x, x, f, c = :thermal)
Thanks!
Abraham
By using Plots’ insets, it is possible:
Plots code
using Plots
function f(x, y)
r = sqrt(x^2 + y^2)
return cos(r) / (1 + r)
end
x = range(0, 2π, length = 30)
theme(:dark)
heatmap(x, x, f, c=:thermal, colorbar=false, inset=(1, bbox(0.85, 0.1, 0.1, 0.8)));
heatmap!(x, x, f, c=:thermal, fg_color=:white, subplot=2)
Nice! That’s exactly it.
Do you have a MWE to share? Thanks!
Please check the MWE code below the plot.
Thanks! I somehow missed it.
I only published the code after your comments. And this because sometimes people are too demanding, like: “ah, it’s close but not transparent enough” or “it’s OKish but not perfectly aligned with the North Star”, etc… , at which point I unplug.