InteractiveViz - an interactive visualization toolkit for large datasets

Thanks @mchitre ! I will try this tomorrow.
I am actually thinking that if the functions return the viz (ifigure) variable, then I might be able to mod the figure a bit more.

I am workting with some matrixes that have some 18e6 datapoints and eveything becomes very painfull. Your code reads and lets me explore the date very well. I am going to try to have a workaround so I can safe it as well :slightly_smiling_face:

I am not very good with makie, but I am defilty interested in helping out with InteractiveViz

Yes, you can get access to the scene as shown above, and do all standard Makie stuff with it. Saving should be possible with Makie using save() on the scene, I believe (I have not used it).

If you have a function which operates on a Scene, then you can create an LScene and have it operate directly on lscene.scene instead.

save("filename.extension", scene) should work.

Could I get an example. InteractiveViz, creates the scene inside a function, but I need to be able to call it out… or save it to a variable before printing

where can I add the let statement? if I add it to a code callin iViz it does not work :frowning:

Not sure I understand your question.

Hello @mchitre. I found a work around.
I just modify the code to return the ifigure (viz) and then I can safe the plot. It is great :slight_smile:

Could you help me a bit with iheatmap? I am trying to plot very noisy matrix. If I change the pooling to maximum I can see the positive picks but I need to saturate the color scale on the negative values. When I use the default mean, i can´t see my data.

Is there a way to change this so I can make my color scales symmetric?

What exactly do you mean by “symmetric” color scale? Maybe you can transform your data so that the colors are scaled in a way that you need?

I added a new Pooling to the code. The options of mean, maximum and minimum did not work for me :(. My data has too many peaks and is very noisy, but this is what I need to see. It is seismic data, and it is a mayhem hehe. I added an if to the code, it pooling=“seis” then the pooling function depends on the sign of the sum of the data:

function heatmappool!(buf::AbstractMatrix, c::Canvas; pooling=mean)
data = c.datasrc.data
data === missing && return
pwidth, qwidth = size(data)
xylims = c.datasrc.xyrect
xpp = width(xylims) / pwidth
ypq = height(xylims) / qwidth
iwidth, jwidth = size(buf)
xyrect = c.xyrect
xpi = width(xyrect) / iwidth
ypj = height(xyrect) / jwidth
ppi = xpi / xpp
qpj = ypj / ypq
for j ∈ 1:jwidth
Threads.@threads for i ∈ 1:iwidth
p = ((i - 1) * xpi + left(xyrect) - left(xylims)) / xpp
q = ((j - 1) * ypj + bottom(xyrect) - bottom(xylims)) / ypq
p1 = round(Int, p - ppi/2) + 1
p2 = round(Int, p + ppi/2) + 1
q1 = round(Int, q - qpj/2) + 1
q2 = round(Int, q + qpj/2) + 1
if p1 > pwidth || p2 < 1 || q1 > qwidth || q2 < 1
@inbounds buf[i,j] = 0
else
p1 < 1 && (p1 = 1)
p2 > pwidth && (p2 = pwidth)
q1 < 1 && (q1 = 1)
q2 > qwidth && (q2 = qwidth)
blk = @view data[p1:p2,q1:q2]

    if pooling == "seis"
      if sum(blk) <= 0.0
        @inbounds  buf[i,j] = minimum(blk)
      else
         @inbounds  buf[i,j] = maximum(blk)
      end
    else
      @inbounds  buf[i,j] = pooling(blk)
    end

    
    
  end
end

end
end

Now a similar figure to the one I posted looks like this (file written from the modification to have access to the .scene).

Nice

Just released a new version v0.4, which uses the fancy Makie layout APIs and therefore makes InteractiveViz much more compatible with all the new wonderful layout stuff.

The data source API has been significantly revamped and improved, and the InteractiveViz API is now very compatible with the Makie API, essentially using the same keyword options. This makes things like multiple plots, colorbars, axis labeling, etc, much easier, and what you know from Makie should simply work.

Check out the README for more details!

P.S. An unfortunate by product of this is that the InteractiveViz API changed slightly and therefore the release is BREAKING, but I feel it is better in the long run.

3 Likes

This is GREAT news! I love the package!

1 Like

Hi @mchitre
Been using the new version and it works great! Thanks a lot.

Just a really silly stuff, would it be possible to include the pooling option a made for the previous version on the current one? This way I do not need to keep a modified copy for several of my projects? :slight_smile:

if pooling == “seis”
if sum(blk) <= 0.0
@inbounds buf[i,j] = minimum(blk)
else
@inbounds buf[i,j] = maximum(blk)
end
else
@inbounds buf[i,j] = pooling(blk)
end

@marianoarnaiz What does seis stand for? If it is generic and useful to many, we can consider adding it to the package. If it is project specific for you, perhaps we can look at a API for users to define new pooling options in their own code without having to modify InteractiveViz package.

Hi @mchitre.
“seis” stands for seismic or seismology. In this field we tend to plot everything with a symmetrical min-zero-max scale (e.g. -1000:1000). In my code, if the sum of the pooling is negative then use the min, and if positive use the max. Simple but effective. Maybe the name could be “symm” but I think it is an useful feature.

@marianoarnaiz Option pool takes in a function, so simple enough for you to define the seis() function in your code and pass it in, right? Or I am missing something here? Can you give me a code example?

Hi again. Sorry for the late reply
How can I pass another pool function to iheatmap? It is not working as before. Thanks in advance.