[Matplotlib-users] Simple 3D support

2008-11-27 Thread Nicolas Rougier

Hi all,

I've been working lately on 3d visualization for my own need and maybe  
the result may have some interest for some of you. I know there is  
already mlab/mayavi2/vtk that does a great job, but after having spent  
a lot of time trying to install all requirements, I headed for a very  
fast, simple and dedicated solution. Currently, scigl (this is the  
name of the framework) dependencies are restricted to OpenGL,  GLUT,  
GLEW  and Boost (for python export).

You can find a beta version at http://www.loria.fr/~rougier/scigl/index.html 
  and the mandatory screenshots are available at 
http://www.loria.fr/~rougier/scigl/screenshots.html 
.


Nicolas



  

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Matplotlib or numpy bug?

2008-11-27 Thread Paul Ivanov
Hi Jesper,

confirming the problem over here, as well. both numpy and mpl from svn
(also on an Ubuntu 8.04 machine).

good luck,
Paul


Jesper Larsen, on 2008-11-27 02:10, wrote:
> Hi Eric and Mauro,
> 
> Thanks for your answers.
> 
> 2008/11/27 Eric Firing <[EMAIL PROTECTED]>:
>> It looks OK to me with mpl and numpy from svn.
> 
> I tried upgrading to numpy from svn as well. Unfortunately the problem
> persists (I have attached a plot). I have seen the problem on two of
> my Ubuntu machines. Maybe it is caused by my specific setup and
> supporting libraries.
> 
> Since I have a working solution and it does not seem to affect others
> (based on a survey of two:-) let us just leave the problem for now. If
> someone else encounter it please let me know and I will try to dive a
> bit into the issue. If the problem turns up again when I have a need
> to upgrade numpy (which is probably when matplotlib requires me to) I
> will also look into it.
> 
> Best regards,
> Jesper
> 
> 
> 
> 
> 
> 
> 
> -
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> 
> 
> 
> 
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Plotting a list of lines

2008-11-27 Thread Mauro Cavalcanti
Dear John,

Thank you very much for your thoughtful reply. Indeed, the code
fragment I sent was incomplete and not expected to do nothing else
than illustrate the general idea (what, hopefully, it did).

You suggested collections, and in my previous attempts I have already
used them (worked quite well, but did not solved my problem).

Perhaps my problem is a simpler than I am being able to see and it is
(still) related to using MPL/Basemap embedded in a wx GUI. Well, in my
previously presented sample application for plotting point-coordinate
datasets (in that case, corresponding to cities) on a Basemap, I have
checkboxes which I use to toggle the points on the map on and off. I
do this by storing the plot corresponding to each dataset in a Python
list, eg.

self.plot_list.append(self.map.ax.plot(longs,lats,'o'))

where map is a Basemap instance and longs,lats are float arrays of
geographic coordinates in decimal format.

Then, in a checkbox event, I do the following:

index = event.GetSelection()
plot = self.plot_list[index]
if self.FileList.IsChecked(index):
   plot[0].set_visible(True)
else:
   plot[0].set_visible(False)

This works quite well and points are properly toggled on/off the Basemap.

But then I want to plot minimum spanning trees connecting the point
datasets. For this I do:

n = len(nodes)
for i in range(n):
   try:
   t = edges[i,0]-1
   u = edges[i,1]-1
   x = [nodes[t,0], nodes[u,0]]
   y = [nodes[t,1], nodes[u,1]]
  self.plot_list.append(map.ax.plot(x,y,'-b'))
   except:
   continue

where nodes is the array of point coordinates and edges are the
from/to indexes of the coordinates, computed with Prim's algorithm.
The lines between points (representing the minimum spanning tree) are
displayed OK. But then my problem appears: I cannot find a way to turn
the entire tree (which is composed of n-1 line segments) on and off of
the map in the same way I do with the points (as shown above). What I
would like is to store all line segments inside the for loop, and then
show the tree at once, outside the loop; so I could use the same
"plot[0].set_visible(True|False)" I use for the points.

Searching the list archives, I found that more than an year ago,
another user, Mr. David Clark, had about the same problem
(http://www.nabble.com/Toggle-plot-trace-tt8968338r0.html). Your
answer to him helped me with toggling of the points, but not with the
lines.

Well, hope to have been as clear as possible.

Thanks in advance for any assistance you can provide, and for your patience!

With best regards,

2008/11/27 John Hunter <[EMAIL PROTECTED]>:
>
> Could you be a little bit more clear about your use case?  In the code
> above, nothing is drawn inside the loop. The Line2D is created but not
> rendered until a figure draw command is issued.  So it would help to
> know what it is that you are trying to achieve, rather than simply the
> approach to the solution you are taking.

--
Dr. Mauro J. Cavalcanti
Ecoinformatics Studio
P.O. Box 46521, CEP 20551-970
Rio de Janeiro, RJ, BRASIL
E-mail: [EMAIL PROTECTED]
Web: http://studio.infobio.net
Linux Registered User #473524 * Ubuntu User #22717
"Life is complex. It consists of real and imaginary parts."

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Arrows acting funny

2008-11-27 Thread OffbeatPatriot

I wanted to make a function to take another function that takes a 2d-vector
and returns a 2d-vector, x and y boundaries, and a resolution, and plot the
slope field.  However all I get is a blank plot over a small range and some
vertical and horizontal lines.  This is my code, if you know differential
equations with the function I'm using you should see a saddle at the origin
and a center at 1,1.

import matplotlib.pyplot as plt

def plot_system(function, xmin, xmax, ymin, ymax, resolution):
 xnow = xmin
 i = 0
 while xnow < xmax:
  ynow = ymin
  while ynow < ymax:
   direction = function([xnow, ynow])
   if direction[0]**2 + direction[1]**2 != 0:
scale = resolution / (direction[0]**2 + direction[1]**2)**.5
print repr(direction[0] * scale) + ", " + repr(direction[1] * scale)
plt.arrow(xnow, ynow, direction[0] * scale, direction[1] * scale)
   ynow = ynow + resolution
  xnow = xnow + resolution
 print "plotting"
 plt.show()
 
if __name__ == "__main__":
 def function(y):
  return [y[0] - y[0]*y[1], y[0]*y[1] - y[1]]
  
 plot_system(function, -10, 10, -10, 10, 1)
-- 
View this message in context: 
http://www.nabble.com/Arrows-acting-funny-tp20713470p20713470.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Plotting a list of lines

2008-11-27 Thread Mauro Cavalcanti
Dear ALL,

Is there a way to plot a list (a Python list) of lines (MPL Line2D
objects) at once?

For example, inside a loop I have:

for i in range(n):
 line, = ax.plot(x,y)
 plot_list.append(line)

In the code fragment above, "plot_list" is an ordinary Python list
which will be filled with matplotlib.lines.Line2D objetcs, each of
them representing a line in the plot. What I would like is how (if???)
to plot this entire list of lines at once in a single plot, outside
the for loop, but obviously this cannot be done with a canonical
"plot" command.

Thanks in advance.

With regards,

-- 
Dr. Mauro J. Cavalcanti
Ecoinformatics Studio
P.O. Box 46521, CEP 20551-970
Rio de Janeiro, RJ, BRASIL
E-mail: [EMAIL PROTECTED]
Web: http://studio.infobio.net
Linux Registered User #473524 * Ubuntu User #22717
"Life is complex. It consists of real and imaginary parts."

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Matplotlib or numpy bug?

2008-11-27 Thread Jesper Larsen
Hi Eric and Mauro,

Thanks for your answers.

2008/11/27 Eric Firing <[EMAIL PROTECTED]>:
> It looks OK to me with mpl and numpy from svn.

I tried upgrading to numpy from svn as well. Unfortunately the problem
persists (I have attached a plot). I have seen the problem on two of
my Ubuntu machines. Maybe it is caused by my specific setup and
supporting libraries.

Since I have a working solution and it does not seem to affect others
(based on a survey of two:-) let us just leave the problem for now. If
someone else encounter it please let me know and I will try to dive a
bit into the issue. If the problem turns up again when I have a need
to upgrade numpy (which is probably when matplotlib requires me to) I
will also look into it.

Best regards,
Jesper
<>-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users