I’ve got a 3D array, representing vector-valued observations at each location on a 2D grid. I’d like to find a way to plot this array so that one subplot shows a spatial slice, while a second subplot shows the data value at the position of the mouse on the first plot. Basic MWE to show the kind of thing I’m looking for:
using Plots x = randn(10, 10, 5) i, j = 3, 7 # spatial coordinates, ideally from mouse hover k = 2 # data layer index, from drop-down menu or similar p1 = heatmap(x[:, :, k], title="Layer $k"); plot!(p1, [i-0.5, i+0.5, i+0.5, i-0.5, i-0.5], [j-0.5, j-0.5, j+0.5, j+0.5, j-0.5], color=:green, linewidth=5, label=""); p2 = plot(x[i, j, :], marker=:o, label="($i, $j)"); plot(p1, p2)
I know how to do this using Interact.jl and slider/dropdown widgets for input, but would really like
j to update automatically based on the mouse hover on
p1. The solution doesn’t have to use Plots.jl if there’s a better package for this task out there. Thanks in advance!