-
-
Notifications
You must be signed in to change notification settings - Fork 355
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
pyplot can't plot heatmap properly for large size matrices #2091
Comments
What happens if you tile the heatmap? Something like: using Plots
pyplot()
data = rand(Float32, 316*2, 316*2)
sc = heatmap(1:size(data, 1)÷2, 1:size(data, 2)÷2, data[1:end÷2, 1:end÷2])
heatmap!(sc, (size(data, 1)÷2 + 1):size(data, 1), 1:size(data, 2)÷2, data[(end÷2 + 1):end, 1:end÷2])
heatmap!(sc, 1:size(data, 1)÷2, (size(data, 2)÷2 + 1):size(data, 2), data[1:end÷2, (end÷2 + 1):end])
heatmap!(sc, (size(data, 1)÷2 + 1):size(data, 1), (size(data, 2)÷2 + 1):size(data, 2), data[(end÷2 + 1):end, (end÷2 + 1):end]) This is likely a backend issue, as even Makie.jl struggles with heatmaps of sufficient size (though, last I remember it was around 20,000 x 20,000, and that was an OpenGL texture issue). This approach may or may not be applicable to Pyplot. Edited to actually plot 4 heatmaps instead of overwriting one. |
This actually produces a problem on GR, where only the last heatmap is actually shown in the plot. @daschw is my Plots syntax wrong, or is this a bug in Plots/GR? There were no warnings other than "multiple series share a colorbar". |
using Plots
pyplot()
data = rand(Float32, 316*2, 316*2)
sc = heatmap(1:size(data, 1)÷2, 1:size(data, 2)÷2, data[1:end÷2, 1:end÷2])
heatmap!(sc, (size(data, 1)÷2 + 1):size(data, 1), 1:size(data, 2)÷2, data[(end÷2 + 1):end, 1:end÷2])
heatmap!(sc, 1:size(data, 1)÷2, (size(data, 2)÷2 + 1):size(data, 2), data[1:end÷2, (end÷2 + 1):end])
heatmap!(sc, (size(data, 1)÷2 + 1):size(data, 1), (size(data, 2)÷2 + 1):size(data, 2), data[(end÷2 + 1):end, (end÷2 + 1):end]) generates |
OK, so that's one approach to circumventing this issue for the time being... |
Is it possible to "hijack" |
On first sight I can't see anything wrong with the syntax, so probably a Plots bug. |
|
I think GR is fine as per this issue, no? |
Perhaps it's possible to special case it and recursively break up the heatmap for the Pyplot backend only? |
That could be possible. |
Plots.jl/src/backends/pyplot.jl Lines 769 to 788 in a1182e0
seems to be the relevant code. Unfortunately, I'm not an expert on matplotlib, so someone else may have to take up the actual implementation. |
Off-topic: How do you reference to/include code as nicely as you did in your post above, @asinghvi17 ? |
Go to the relevant code in the browser (on the Github interface), select the relevant linenumbers in the sidebar (they should show up in yellow), then click on the |
Thanks! |
Do not know, if this is still a relevant issue (at least it is open), but I don't have any trouble with plotting matrices as big as 10000x10000 in the current version (Julia v1.3.1, PyPlot v2.8.2, Plots v0.29.1)
Colorbar is a mess though. |
pyplot backend fails to plot heatmap for large size matrices.
gr backend works fine.
The critical value is between 316 and 317.
316
317
316^2 = 99856 and 317^2 = 100489 so then it seems to have problems when the components are more than 100000.
The text was updated successfully, but these errors were encountered: