|
From: Eric F. <ef...@ha...> - 2006-05-23 18:44:04
|
Jordan Dawe wrote: > >>> This is probably what you want to do. You want to define your arrow >>> in something like points, then do a rotation, and then apply one of >>> the transformation offsets to place your arrow at an x,y location. >>> Note there is a bug in some version of matplotlib in the affine code >>> which is fixes in SVN -- this arrow should have it's base at 0.5, 0.5 >>> and be pointing NW and measure 2 inches from base to tip. The arrow >>> size is independent of zoom and figure window size, which may or may >>> not be desirable.... > > Ok, I've done a bunch of work on making quiver work without distorting > the arrows. I have a lot of questions. I've been playing with the > transforms functions all weekend and I still don't understand the > different transforms between figure, axes, and absolute space. Or how > to get access to the 'width' and 'height' Values that are mentioned in > the comments of transform.py. > > The arrow size in quiver() should not be independent of zoom; it should > scale with the figure and axis size. Ideally by default quiver() should > ensure that the largest arrow doesn't overlap the 'gridbox' of the > arrows next to it. The problem is that in order to ensure the arrow is > rotated properly, the rotation must take place in absolute coordinates, > but the length scaling should take place in data coordinates. > Furthermore, the scaling should be a conditional: it should see if the x > or the y axis is most 'in danger' of having an arrow larger than its box > in data space, and then scale both the x and y coordinates equally in > absolute space to ensure the arrow isn't distorted. I'm not sure this > is even possible with Values; I think it would require at least a > greater_than BinOp, but I don't really understand all the transform > functionality or how to get access to it. Is there a way to do this? > > After looking at all the files this weekend, I'm still not even sure > what matplotlib considers to be 'first-class' primitives. Is it > patches, lines, etc? What should a call to quiver() return? A list of > polygons? It's returning a collection in svn, but I don't think you can > set each object in a collection to a different transform. When should a > collection be used? I think your questions here have two aspects. The first is, exactly what functionality should quiver have? I have always thought Matlab's quiver was ugly and fairly useless for my own purposes, so I don't advocate copying it. Have you written out a docstring or other specification of what quiver should do and what its API should be? The second part is, what should Axes plotting methods return? There are two styles: contour returns a whole ContourSet object; most (all?) other methods return only the Artists (e.g. a Line or a Collection.) When I changed contour to return the ContourSet, and more recently when I did a little reorganization of axes.py, John mentioned that it might be desirable to make other methods behave similarly, but I don't think there has been any more recent discussion, and I have not gotten back to it myself. Returning higher-level objects does fit in with moving more complicated functionality out of axes.py, which I would still like to do--eventually. > > I don't know if I'm making any sense here; I'm fairly frustrated after a > weekend with little progress. Is there any hidden documentation that > could help me? I made some scratch-paper notes for myself, but never considered my understanding complete, and it fades fast. Parts are covered quite well in the transforms.py docstring, but a good overview, clearly laying out the various coordinate systems (with a good naming convention) and where and how transformations are made would be a big help. This is something I might be able to work on, but it might not be very efficient for me to do it. And I might not be able to do it fast enough to help with your present quivering. Eric |