Plots.jl: gr contour sometimes shrinks plot

Created on 26 Jul 2016  路  16Comments  路  Source: JuliaPlots/Plots.jl

This code fails in a weird way, by shrinking the plot:

y=[-0.997669
 -0.979084
 -0.942261
 -0.887885
 -0.81697 
 -0.730836
 -0.631088
 -0.519584
 -0.398401
 -0.269797
 -0.136167
  0.0     
  0.136167
  0.269797
  0.398401
  0.519584
  0.631088
  0.730836
  0.81697 
  0.887885
  0.942261
  0.979084
    0.997669]
gr()
contour(linspace(-0.99,0.99,23),y,rand(23,23))
GR bug

All 16 comments

screen shot 2016-07-26 at 1 45 38 pm

I can reproduce. Interesting to note that if you add fill=true then it works as expected. The difference in the calls is this:

            if series[:fillrange] != nothing
                GR.surface(x, y, z, GR.OPTION_CELL_ARRAY)
            else
                GR.contour(x, y, h, z, 1000)
            end

@jheinen any idea what's going on?

@tbreloff , GR.contour() never requires OpenGL, but GR.surface() probes for hardware acceleration. Unfortunately, the test seems to fail - we have to improve this ...

@jheinen what does hardware acceleration have to do with this example? To clarify, the problem is that the call to GR.contour seems to draw in a shrunken part of the screen.

@tbreloff , sorry, forget the last comment. I'll try to reproduce the problem soon ...

Unfortunately, this is a restriction of GR's internal contour algorithm, which only supports regular grids. In the above example, the grid is rectilinear (see y component).

You can use meshgrid and gridit to create a regular grid which can then be passed to the contour routine, but I think, this is not a good solution:

x, y = meshgrid(x, y)
x, y, z = gridit(vec(x), vec(y), vec(z), 50, 50)
contour(x,y,z)

The problem is on my radar and I'll try to find a better solution ... (or modify the existing algorithm)

I can still reproduce this issue

Just fixed in https://github.com/jheinen/gr/commit/fa3570affed1130ecf02e19d8e01b23dddce94be - CI build is running and new runtime will be available soon ...
screen shot 2017-11-06 at 15 42 37

ENV["GRDIR"]=""; Pkg.build("GR")
import GR; GR.version()
"0.27.0.post10"

... should fix it

Great @jheinen! I'm closing this now.
@dlfivefifty Feel free to reopen if you encounter any issues.

I still get the error - my GR version is "0.27.0" - was it somehow not completely rebuilt?

Oh, same here ...
How do we get to "0.27.0.post10"?

Are you using GR master?

Yes, I think so, I will check later ...

I'm on master, and also did a fresh Pkg.checkout("GR") before rebuilding.

Just checked I could reproduce the issue then I did

Pkg.checkout("GR")
ENV["GRDIR"]=""
Pkg.build("GR")

and now the issue is fixed for me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cortner picture cortner  路  4Comments

kleinschmidt picture kleinschmidt  路  3Comments

Krastanov picture Krastanov  路  3Comments

apalugniok picture apalugniok  路  3Comments

asinghvi17 picture asinghvi17  路  3Comments