I have two functions f, g with different ranges but same domain. I visualize function f through a heatmap and function g through a contour map. To be able to plot them together I have to rescale g as seen in the code below. This way they have the same range.
using Plots
x = range(0, 10, 100)
y = range(0, 10, 100)
f = @. sin(x)' * sin(y)
g = (x, y) -> (x^2 - y ^2) * sin(x)*sin(y)
normalization = max(f...) / max(@. g(x', y)...)
desired_g_value = 1.
p = heatmap(x, y, f,
colorbar_title ="f")
contour!(p,
x,
y,
(x ,y) -> normalization * g(x, y),
levels=normalization*desired_g_value:normalization*desired_g_value,
clim=(-1, 1), # range of f
c=:black
)
This yields the following plot:
I would like to have at the left of the colorbar the ticks for the function g (before rescaling). Is it possible? If so, how?
