GR Plot issue? GR vs PyPlot, PlotlyJS

Hi,

I am plotting the same thing with two different backends and yet I don’t get similar plots. For example, the convexity of some levels are inverted.

Hence, I am wondering which one is the good result…
Note that this is the solution of a PDE.

gr()
contour(time[1:10:end],e[2:end],(gg)[1:10:end,:]',title=string("g(t,v) network for N =10000"),color=:magma,fill=true)

or

pyplot()
contour(time[1:10:end],e[2:end],(gg)[1:10:end,:]',title=string("g(t,v) network for N =10000"),color=:magma,fill=true)

Thank you for your help,

Best regards

I have a minimal working example for this. I put the data here.

Does anyone know what is happening?

using Plots,JLD
gg, e, tt = JLD.load("example-issue-plot.jld", "gg", "e", "tt")
sub = 100

time = tt[1:sub:end]
v = e[2:end] |> collect
z = gg[1:sub:end,:]

gr()
    pyplot()
    heatmap(time,v,z' ,title=string("g(t,v) network for N =10000"))

I also have the plot from plotlyjs.

@jheinen So it seems GR is the culprit

network-error

Can you plot something similar but easily replicable with known appearance? Like u(x,y) = (1-y^2) \sin(x + ky) for some small k over x,y \in [0, n\pi] \times [-1, 1]?

t = linspace(0,5,1000)
X = cumsum(exp(-10sin(2t).^2))
Y = linspace(0,4pi,150)
u = [(1-y^2)*sin(x+y) for x in X, y in Y]


gr()
pyplot()
heatmap(X,Y,u')

The problem is, that time is non-equidistant. I have to check this in GR and probably re-sample the grid.

Seriously? That may impede a published paper…

Unfortunately, yes. :disappointed:

The following code produces correct results:

using Plots, JLD
gg, e, tt = JLD.load("example-issue-plot.jld", "gg", "e", "tt")
sub = 100

time = tt[1:sub:end]
v = e[2:end] |> collect
z = gg[1:sub:end,:]

import GR
x = linspace(time[1], time[end], 800)
y = linspace(v[1], v[end], 800)
z = GR.interp2(time, v, z, x, y)

heatmap(x, y, z', title=string("g(t,v) network for N =10000"))

I will change the heatmap and contour functions accordingly …

Sorry for the trouble.

1 Like

Please be mindful that someone is offering to donate their time to investigate and fix a problem that doesn’t affect them, to benefit you. @jheinen is one of the more responsive and generous maintainers in the community.

(I was writing this when @jheinen then further proved my point. :slight_smile: )

7 Likes

Sorry… I meant “Really?”, I did not choose my word carefully. I love GR, the only reason I don’t use it directly instead of Plots is because I use PlotlyJS sometimes for its interactive capabilities.

Thank you for your help,

Best regards

1 Like