enabling gridlines in vispy/examples/demo/scene/picking.py

268 views
Skip to first unread message

JoX^

unread,
Aug 7, 2015, 4:34:55 AM8/7/15
to vispy
Trying out vispy but have issues getting the grid to be setup correctly, can someone guide aid me what im doing wrong?

vispy/examples/demo/scene/picking.py
# create figure with plot
fig = vp.Fig()
plt = fig[0, 0]
plt._configure_2d()
plt.title.text = 'Current Clamp Recording'
plt.ylabel.text = 'Membrane Potential (mV)'
plt.xlabel.text = 'Time (ms)'
grid = vp.visuals.GridLines(color=(0 , 0, 0, 0.5))
grid.set_gl_state('translucent')
plt.view.add(grid)

selected = None

This will enable the grids above the graph data but the point, that is selected will actually be shown above the grid, but not the actual line.
Seems something to do with layer of rendering.


Have a nice day!

Luke Campagnola

unread,
Aug 8, 2015, 2:24:22 PM8/8/15
to Vispy list
The real problem is that the plot lines have depth testing enabled, so they are refusing to draw in the area where the grid has already drawn because it has the same depth value (the grid actually draws on all pixels, even between lines, because of a separate issue). You can fix it by adding `line.set_gl_state(depth_test=False)`  after creating each plot line. 

However this should not be necessary--depth testing should probably be disabled by default for 2D plots. Possibly we can make this decision based on the dimensionality of the data passed into the plot line, but we usually try to avoid that kind of implicit behavior. Perhaps you could open an issue for this?




--
You received this message because you are subscribed to the Google Groups "vispy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vispy+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages