# GR Plot issue? GR vs PyPlot, PlotlyJS

#1

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)


Best regards

#2

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"))


#3

I also have the plot from plotlyjs.

@jheinen So it seems GR is the culprit

#4

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]?

#5
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')


#6

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

#7

Seriously? That may impede a published paper…

#8

Unfortunately, yes.

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.

#9

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. )

#10

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.