From: Matthieu B. <mat...@gm...> - 2007-03-12 09:45:42
|
OK, I'm trying to the same but in 3D, and there, no documentaion. I tried to launch axes3d.py to see exactly what I can do, but the example file does not work. For instance, Axes3D takes two parameters for method __init__ and only one is provided. Did someone test it ? I'm trying to use collection as well, but for once I prefer MatLab simplicity here, it's way to complicated, some arguments must be zipped, other are passed not in the collection, but when the collection is added to the subplot, ... Is there a simple and clear way to do 3D plotting with collections ? Matthieu 2007/3/12, Matthieu Brucher <mat...@gm...>: > > I manage to do what I wanted to do, it was not that easy - the colours > were in an array I had to transform into an array of tuples, the autoscale > did not function, I had to put in the fig.subplot the correct xlim and > ylim -, but now it works like a charm. > Many thanks. > > Matthieu > > 2007/3/9, John Hunter <jd...@gm...>: > > > > On 3/9/07, Matthieu Brucher <mat...@gm...> wrote: > > > > > What I have is a set of points in a numpy.array - for instance size > > (2000, > > > 2) -. What I have as well is a nump.array of size (2000, 3). How can I > > make > > > plot understand that each line of the set points must be painted with > > the > > > corresponding line in the colour array ? > > > > You'll probably want to use a regular poly collection, as in the > > example below. Your array of facecolors can pretty much be whatever > > you want: > > > > from pylab import figure, nx, show, cm > > from matplotlib.collections import RegularPolyCollection > > > > > > fig = figure() > > ax = fig.add_subplot(111) > > > > offsets = nx.mlab.rand(20,2) > > facecolors = [cm.jet(x) for x in nx.mlab.rand(20)] > > black = (0,0,0,1) > > > > collection = RegularPolyCollection( > > fig.dpi, > > numsides=5, # a pentagon > > rotation=0, > > sizes=(50,), > > facecolors = facecolors, > > edgecolors = (black,), > > linewidths = (1,), > > offsets = offsets, > > transOffset = ax.transData, > > ) > > > > ax.add_collection (collection) > > > > show() > > > > > > > > > > > > > > > > > Matthieu > > > > > > > > ------------------------------------------------------------------------- > > > Take Surveys. Earn Cash. Influence the Future of IT > > > Join SourceForge.net's Techsay panel and you'll get the chance to > > share your > > > opinions on IT & business topics through brief surveys-and earn cash > > > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > > _______________________________________________ > > > Matplotlib-users mailing list > > > Mat...@li... > > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > > > > > > > |