I hope you had a nice holiday.
I am glad you like the patch and find it useful. Applying it over the weekend is fine with me.
- You are right that the CuboidCollection is not that necessary. In fact I used to have my histogram heuristic in the Poly3DCollection just as you describe. But while running through the examples before submitting the patch, I found that it broke the surface plots. So I refactored the code so that my changes only affected the bar3d plots, since this is the only thing I wrote code for and tested.
My plan for the z-order sorting heuristic is to allow the user to choose the best one for his specific needs. (This is only needed until we have a more general purpose 3D engine as being discussed in another thread.) You can see that I split out the z-order sorting code into self-contained methods. They don't reference any 'self' members, so these methods don't even need to be in the Poly3DCollection class. It would be really nice if the user could pass in a function pointer for the heuristic parameter, in addition to 'average' and 'histogram'. That way, users could even write their own specialized heuristic and not need to modify the mplot3d source.
I wanted to create a standard set of data for the parameter of the sorting heuristic function. You can see that _sort_polygons_avg() is the same algorithm as your original, except that I give the method, the x,y,z coords instead of just x and y. There is a little extra work to strip out the z data, but it allows the more advanced histogram heuristic function to take the same data. In fact, I have an idea for a slightly improved heuristic, but I would need to pass in the 'real world' XYZ coords, in addition to the 'screen' XYZ coords. There is a note about this in the code comments of _sort_polygons_hist().
I'd like to hear your thoughts on this.
- about the text() function, that is fine.
- about the #end comments, that is fine. I'll try not to use them in the code anymore.
I have a number of other specific questions about mplot3d for you. They will follow in another email.
From: Reinier Heeres [mailto:reinier@…707…]
Sent: Wednesday, February 24, 2010 7:12 PM
To: Ben Axelrod
Subject: Re: [matplotlib-devel] many mplot3d fixes
Hi Ben, all,
First of all: thanks for your patch. With a few minor modifications I think we should apply most of it. I had a quick look now, but let's aim to get it in over the weekend.
Let me also say that as far as I'm concerned, mplot3d is here to stay and I will try to continue to support it. However, some help for this would be greatly appreciated, and it seems you can find your way around the code just fine!
- I'm not entirely sure whether the CuboidCollection class you wrote is completely necessary, wouldn't it also be possible to use Poly3DCollection instances? (which should be correctly sorted). Then the only thing that would have to be added to Poly3DCollection is the histogram heuristic.
- For the text() function, I think we should probably pass all kwargs to Axes.text() instead of the explicit version you used.
- If you don't mind I'll remove the #endif etc comments, they appear nowhere in the codebase as far as I know.
Pleas let me know what you think!
On Wed, Feb 24, 2010 at 7:39 PM, Ben Axelrod <BAxelrod@...817...> wrote:
Here is a major patch for mplot3d. Here is a summary of the changes:
* bug fix: placement of title in 3D plots to match 2D plot behavior
(see nonecolortester.py to demonstrate)
* bug fix: allow facecolors and edgecolors to be specified as 'none'
in 3D scatter plots to match the 2D scatter plot behavior (see
nonecolortester.py to demonstrate)
* bug fix: allow all keyword arguments to be used in text3D (see
modified example code text3d_demo.py)
* bug fix: allow an array of colors to be passed into bar3d to
specify the colors on a per-bar or per-face basis (see new example
* bug fix: allow all keyword arguments to be used in bar3d (see new
example code hist3d_demo2.py)
* bug fix: allow 3d scatter plots with 3 or 4 points with colors
specified (see colortester2.py to demonstrate)
* new feature: new method to disable mouse rotation in 3D plots
* new feature: allow mouse rotation and zoom buttons to be specified
* new feature: new Z-order sorting heuristic to eliminate rendering
issues for the common case of using bar3d to visualize a 2D histogram
(see modified example code hist3d_demo.py)
* new feature: new method text2D (see modified example code
* code cleanup: warn when canvas is None which disables mouse
* code cleanup: document more methods in mplot3d
-------- Download Intel® Parallel Studio Eval Try the new
software tools for yourself. Speed compiling, find bugs proactively,
and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
Matplotlib-devel mailing list
Tel: +31 6 10852639