Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why is the iheatmap! function no longer supported? #21

Closed
13299118606 opened this issue Nov 3, 2023 · 16 comments
Closed

Why is the iheatmap! function no longer supported? #21

13299118606 opened this issue Nov 3, 2023 · 16 comments
Assignees
Labels
enhancement New feature or request

Comments

@13299118606
Copy link

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

@mchitre
Copy link
Member

mchitre commented Nov 3, 2023

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?

@mchitre mchitre self-assigned this Nov 3, 2023
@mchitre mchitre added question Further information is requested enhancement New feature or request and removed question Further information is requested labels Nov 3, 2023
@13299118606
Copy link
Author

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!

@mchitre mchitre closed this as completed Nov 3, 2023
@ConnectedSystems
Copy link
Contributor

ConnectedSystems commented Nov 5, 2023

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.

@mchitre
Copy link
Member

mchitre commented Nov 6, 2023

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

@ConnectedSystems
Copy link
Contributor

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?

@mchitre
Copy link
Member

mchitre commented Nov 6, 2023

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

@ConnectedSystems
Copy link
Contributor

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.

@mchitre
Copy link
Member

mchitre commented Nov 6, 2023

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)

@ConnectedSystems
Copy link
Contributor

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.

@mchitre
Copy link
Member

mchitre commented Nov 7, 2023

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

@ConnectedSystems
Copy link
Contributor

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.

@mchitre
Copy link
Member

mchitre commented Nov 7, 2023

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.

@ConnectedSystems
Copy link
Contributor

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

@marianoarnaiz
Copy link

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!?

@ConnectedSystems
Copy link
Contributor

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.

@marianoarnaiz
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants