JuliaPlots / Plots.jl

Powerful convenience for Julia visualizations and data analysis
https://docs.juliaplots.org
Other
1.84k stars 354 forks source link

Interpolation seems incorrect in contour #3270

Open songhanzhang opened 3 years ago

songhanzhang commented 3 years ago

I am currently doing numerical simulations. When using contour (with interpolation) to plot the 2D wave field, fluctuations are present in small-value areas, which should not exist. I have tried GR heatmap, GR contour and GLMakie heatmap, and the results are given below (along with part of the codes):

1. Plots GR heatmap:

heatmap!(fig_uy, 0:0.1:10, 0:0.1:5, Ug_y, clims = (-u_max/5,u_max/5), c = :coolwarm, interpolate = true)

ani_acoustics_GR_heatmap

The interpolation is not supported. However, I remember that the interpolation was supported in a very old version (in 2016 if I remember correctly), and I don't know why it is no longer supported in the later versions.

2. Plots GR contour:

contourf!(fig_uy, 0:0.1:10, 0:0.1:5, Ug_y, clims = (-u_max/10, u_max/10), level = 1000, linewidth = 0, fillrange = true, c = :jet, colorbar = false)

ani_acoustics_GR_contour

This is quite convenient to use, and the interpolation is supported indeed, while the results may have some issues. The small-value areas (such as the left top and left bottom blocks) should be uniformly green (as can be seen from the remaining two figures), but there are quite a lot of fluctuations.

3. GLMakie heatmap:

heatmap(resolution = (500,300), 0:0.1:10, 0:0.1:5, transpose(Ug_y), colorrange = (-u_max/10,u_max/10), colormap = :jet, scale_plot = false, show_axis = false, interpolate = true, colorbar = true)

ani_acoustics_GLMakie_heatmap

In this figure, the interpolation is allowed and the result looks correct.

In my programming code, I prefer very much to keep using Plots instead of switching to GLMakie, as GLMakie is not easy to use at least for me (even just adding a colorbar makes me so struggle in GLMakie).

So, is it possible, either, to add the interpolation feature in heatmap, or, to fix the interpolation issue in contour? This will be quite useful to the visualization of numerical modellings. (I have tried a few other backends such as pyplot and plotly, but the results are the same.)

daschw commented 3 years ago

Could you provide an example matrix, where these unexpected fluctuations appear in the GR heatmap?