org-arl/InteractiveViz.jl

Why is the iheatmap! function no longer supported?

Closed this issue ยท 16 comments

This package supports ilines! and iscatter! functions. I want to use iheatmap! but it does not exist.

This package supports ilines! and iscatter! functions, I want to use iheatmap! but it does not exist. It can be seen in the file that there is no definition of this function src\interface.jl

The reason heatmap! isn't supported but heatmap is, is that it is unclear how heatmap! should blend heatmaps. You can plot a heatmap first and then use lines! etc to plot things on top, if needed.

If heatmap! were to be supported, how would you want it to work?

Thank you very much for your answer. I was stupid. I adjusted the heatmap and line! The order is also achievable, not line and heatmap!

I have the same question.

In my case, blending of the data sets doesn't really matter.

I'm mocking up a dashboard with some sliders and want to see how two (very large) rasters compare with each other as values are filtered out (the range that is filtered is controlled by the sliders).

At the moment, I'm resampling to get a lower resolution dataset to work with and overlaying these two with the base heatmap function. The last heatmap to display is given increased transparency.

It would be nice to be able to do this with InteractiveViz.

@ConnectedSystems can't you do this with MakieLayout by having the two heatmaps in different axes?

I guess I could if I was okay with having two different axes.

I think the larger issue is that, from experience, for interactive displays it tends to move one and only one axes when the user moves the view around, and linking the axes is a bit flakey - it doesn't always work or work as expected. Maybe things have changed now though?

Yes, the layout and linking in Makie is excellent and works well. I use it often.

Sorry, but how would I do this in combination with InteractiveViz?

The twin axis example pattern in Makie is:

f = Figure()

ax1 = Axis(f[1, 1], yticklabelcolor = :blue)
ax2 = Axis(f[1, 1], yticklabelcolor = :red, yaxisposition = :right)
hidespines!(ax2)
hidexdecorations!(ax2)

lines!(ax1, 0..10, sin, color = :blue)
lines!(ax2, 0..10, x -> 100 * cos(x), color = :red)

But I can't do this with InteractiveViz:

f = Figure()
hm = iheatmap(f[1,1], range(0, 10; length=1000), range(0, 1; length=10000), randn(1000,10000))
ax = hm.axis

# Overlay another heatmap on top:

# doesn't work of course
iheatmap(ax, range(0, 10; length=1000), range(0, 1; length=10000), randn(1000,10000))

# also doesn't work
iheatmap(hm.figure[1,1], range(0, 10; length=1000), range(0, 1; length=10000), randn(1000,10000))
# ERROR: You have used the non-mutating plotting syntax with a GridPosition, which requires an empty GridLayout slot to 
# create an axis in, but there are already the following objects at this layout position:

# Any[Axis (1 plots)]

# If you meant to plot into an axis at this position, use the plotting function with `!` (e.g. `func!` instead of `func`).
# If you really want to place an axis on top of other blocks, make your intention clear and create it manually.

This is an example from the InteractiveViz.jl README on how to use Makie layout with InteractiveViz:

julia> using GLMakie
julia> f = Figure()
julia> p1 = iheatmap(f[1,1], julia, -2, 2, -1.75, 1.75; colormap=:magma)
julia> p2 = iheatmap(f[2,1], mandelbrot, -2, 0.66, -1, 1)
julia> Colorbar(f[1,2], p1.plot)
julia> Colorbar(f[2,2], p2.plot)
julia> p3 = ilines(f[1,3], sin, 0, 100; axis=(; limits=(0, 100, -1.5, 1.5)))
julia> p4 = ilines(f[2,3], range(0, 100; length=10000), randn(10000))
julia> linkxaxes!(p3.axis, p4.axis)

Okay, I see - there's a misunderstanding here.

I'd like to put two heatmaps on top of each other, overlaid in the same figure.

The example you shared puts them on two separate rows.

Overlaid will require some kind of blending or occlusion. Perhaps you can show an example of what you're trying to achieve?

Yeah sure,

Say I have a raster I am displaying as a heatmap:

image

I'm overlaying another heatmap on top with some opacity to highlight a given area, according to some criteria (in yellow).

image

I don't think blending/occlusion concerns are important in this specific use case.

To display data from two different sources on the same pixel with some opacity, you essentially need some form of blending. That isn't supported at present. I'm open to supporting it if we have a clear requirements of how this is done. Opacity is one way to blend, and a reasonable starting point, so I'll open an issue to implement it someday.

Thank you! Appreciate you being open to supporting this capability.

Hi all, I just found this after I posted yesterday. I think maybe iheatmap! is important because you might want to empty and axis in a script and them plot another heatmap in. Is it possible to reinstate iheatmap!?

Hi @marianoarnaiz

I will submit a PR for what I have at the moment this weekend, if not before. It works but it is no way a clean implementation.

Hi @ConnectedSystems
Thanks a lot :). I am using InteractiveViz to create a little GUI to process my data and one of the things is that I read some data, plot it, then process it, plot it, ect. All in the same axis, so iheatmap! is necessary for my implementation to work with a lot of data points.
Thanks again.