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

Heatmap or contour bug in Makie. #2560

Closed
crazyfireji opened this issue Jan 6, 2023 · 9 comments
Closed

Heatmap or contour bug in Makie. #2560

crazyfireji opened this issue Jan 6, 2023 · 9 comments

Comments

@crazyfireji
Copy link

crazyfireji commented Jan 6, 2023

When I plot a contour or heatmap, the input axies must 1D,but if my geometry is not irregular, the axis must be 2D, but Makie can't plot this irregular geometry contour; like x, y=meshgrid(sin[1:10],1:10) in Pyplot or matlab.
such as:

x = zeros(10, 10); y = zeros(10,10); z = rand(10,10)
for i in 1:10, j in 1:10
     x[i, j] = i
    y[i, j] = sin(0.1*i)*j
end

heatmap(x,y,z) or contour(x,y,z), it cant work, but can work in PyPlot.contour(x,y,z).
it may plot using tricontour(vec(x), vec(y), vec(z)), but if the data is big, it works so slow and will appear some error

@crazyfireji
Copy link
Author

crazyfireji commented Jan 6, 2023

mmexport1672973389098
In Makie, the contour will use the first col of x and the first row of y to plot the fig, so the fig is regular shape,but it can work well in pyplot,like
mmexport1672973387551

@jkrumbiegel
Copy link
Member

It would help if you posted a complete example with test data that we can run to understand your issue. I can only guess how you produced those images.

@SimonDanisch
Copy link
Member

Try:

surface(x, y, fill(0, (10, 10)), color=z)

@crazyfireji
Copy link
Author

using GLMakie x = zeros(1000, 1000); y = zeros(1000,1000); z = rand(1000,1000) for i in 1:1000, j in 1:1000 x[i, j] = i y[i, j] = sin(0.001*i)*j end heatmap(x,y,z)
it can't works, but it can works in pyplot
import PyPlot as plt plt.contour(x,y,z)
result like this
mmexport1673003060259

@SimonDanisch
Copy link
Member

Try surface(x, y, fill(0, (10, 10)), color=z) instead of heatmap

@SimonDanisch
Copy link
Member

heatmap/contour not working for surface inputs is discussed here: #748

@crazyfireji
Copy link
Author

Try surface(x, y, fill(0, (10, 10)), color=z) instead of heatmap

Thank you very much,it can work, but the color is so dark
mmexport1673003919663

@SimonDanisch
Copy link
Member

Ah, it should be surface(x, y, fill(0, (10, 10)), color=z, shading=false)

@crazyfireji
Copy link
Author

Ah, it should be surface(x, y, fill(0, (10, 10)), color=z, shading=false)

Thank you very much

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

No branches or pull requests

3 participants