1

I'm relatively new to Python and all the wonders contained within, and I'm attempting to create a program that is able to display a lot of data points in 3D. The problem is, going through the traditional route with matplotlib is very slow, rotating the data around on screen is very choppy and clunky.

So then I turned to VisPy, a fairly new distribution promising fast data visualization through GPU processing. The issue is, I don't know a thing about OpenGL, but not to worry says VisPy, I'll still work just fine for you!

So, through some digging, I've found that this easy, high-level, high-performance plotting ability with VisPy, which completely shields the user from the terrors of OpenGL, is contained within a module, MPL_Plot, which can overwrite matplotlib commands so all you have to do is program in those nice and simple commands, and it will run in high speed VisPy off your GPU!

Now that's all well and good, but here is where I, a novice at python, ran into some trouble. Here is the documentation for that particular miraculous module:

http://api.vispy.org/en/latest/mpl_plot.html

And that's it.. I'm not sure if I'm missing something, but there's not much there that I know how to work with.

Nonetheless, as a proper programmer, I didn't give up there, I kept searching page after page for examples, or some other way to attack this problem, and eventually I found this lone example: http://api.vispy.org/en/latest/examples/basics/plotting/mpl_plot.html

And, armed with the knowledge I gained from digging into this example, I copy-pasted some commands into my own program, and it compiled! But left just a blank VisPy canvas with no data points plotted.

So, my question to you, is first and foremost, how do you actually use VisPy without getting down and dirty with OpenGL, and second, what things am I doing wrong with the code below:

Here is the relevant code:

.
.
.

#Attempting to get it to work in just 2D first

import vispy.mpl_plot as plt
fig = plt.figure()
ax = plt.subplot(111)

ax.plot(x_list,y_list, 'k-')

plt.draw()
plt.show(True)

where x_list and y_list are equal-length lists of integers

NGXII
  • 407
  • 2
  • 9
  • 18

2 Answers2

2

VisPy's mpl_plot is still very early in development. You might have more luck with the scenegraph API (examples/basics/scene/markers.py might get you started), but even that is still undergoing major development.

Luke
  • 11,374
  • 2
  • 48
  • 61
  • Looks like they've taken down the examples, but I've been going through the scenegraph API and it looks promising! Though at the moment I have no clue how to create an object that isn't centered at the origin.. any ideas? What are the basics for the scenegraph API? – NGXII Jul 14 '15 at 01:45
  • You need to assign a transform to a visual if you want it moved elsewhere. Many examples of this are available in `examples/basics/scene`. – Luke Jul 16 '15 at 08:04
0

You found a bug in Vispy 0.4.0. It was fixed around the same time you posted this question. If you download 0.5.0 dev0 from the git respository and install that version, you will be able to get that example to render properly.

I had the same problem, until about an hours ago.

Ryan Budney
  • 308
  • 1
  • 6
  • 16
  • vispy 0.5.0 dev0 doesn't have mpl_plot module anymore, it was removed https://github.com/vispy/vispy/pull/1224 – martinako Nov 10 '16 at 15:37