-
-
Notifications
You must be signed in to change notification settings - Fork 372
Description
As far as I understand, it isn't currently possible to plot multiple times with different 'z' axes on the same 2D subplot. Being able to do this would be very helpful. By this I mean that one can plot using different colour maps and limits on these and each layer preserves its original limits.
I have often wanted the following to work:
julia> using Plots
julia> x1 = y1 = 0:π/11:π
x2 = y2 = 0:π/101:π
nx1, ny1 = length.((x1, y1))
p = heatmap(x1, y1, rand(nx1, ny1).+10, c=:gray, cbar=false)
contour!(p, x2, y2, sin.(x2).*sin.(y2)', c=:rainbow, xlim=extrema(x2), ylim=extrema(y2), levels=0:0.2:1, cbar=true, clim=(0,1))What I expect to happen is that the underlying heatmap has limits automatically scaled to be in the range [10,11], and the overlying contours are plotted with their own scale in [0,1], and we would see some contours on top of a heatmap. Ideally, one would be able to have multiple colourbars, but I recognise that's hard whilst Plots uses native colourbars.
If we issue these commands in series we can see how the limits are changed and the heatmap becomes invisible:
julia> x1 = y1 = 0:π/11:π
x2 = y2 = 0:π/101:π
nx1, ny1 = length.((x1, y1))
p = heatmap(x1, y1, rand(nx1, ny1).+10, c=:gray, cbar=false)julia> contour!(p, x2, y2, sin.(x2).*sin.(y2)', c=:rainbow, xlim=extrema(x2), ylim=extrema(y2), levels=0:0.2:1, cbar=true, clim=(0,1))
whereas now the heatmap colour scale is saturated at the new z scale.
In the past I have hacked around this by scaling all the different layers to have the same limits (e.g. for this figure where I plot topography, colours and contours) but it would be great if this could be done automatically.
