From: John H. <jdh...@ac...> - 2004-10-11 14:17:15
|
>>>>> "Roberto" == Roberto De Almeida <ral...@gm...> writes: Roberto> Yes, my idea is to do it "properly", but I'm still Roberto> getting myself familiar with the code. Roberto> My original plan was to create a class Roberto> PolarSubplot(PolarAxes), in the same way that Subplot Roberto> derives from Axes. I would then create the PolarAxes Roberto> class, implementing all the necessary methods, like Roberto> plot(), imshow(), etc. That's why I mentioned imshow() Roberto> and pcolor(), because my idea is to implement not only Roberto> line plots, but specially pseudo color plots on the polar Roberto> axes. Roberto> After looking at the code for transforms, though, I'm not Roberto> sure if all this is really necessary. It seems to me that Roberto> I can define a polar transform, and simply reuse all the Roberto> methods already defined in the Axes class to the all the Roberto> work, is that right? I believe creating a PolarAxes is the way to go. I would probably also derive specialized Axis classes as well to handle the r and theta axis, using a matplotlib.patches.Circle rather than a matplotlib.lines.Line2d for the theta axis and grid lines. You would probably also need to add a rotation property to the ticks class, do that the ticks could be placed normal to the theta axis. I could help out here - it might call for a new line style, one along the lines of '_', '|' (which the current ticks use) but that could be rotated. Once you get the axis, transformations and grids set up right, yes, I believe you will be able to reuse many of the plotting methods. I'm fairly certain some work will need to be done to make images, pcolors and other plots work with though. But the basic plot and friends should work without modification. Roberto> I saw the PolarXY transform in the _transforms module, Roberto> but it seems to be just a stub (matplotlib 0.63.0) -- it Roberto> has no defined methods. Yes and no. The PolarXY class defines in _transforms.h // the api forward and inverse functions; theta in radians std::pair<double, double> operator()(const double& r, const double& theta ) { return std::pair<double, double>( r*cos(theta), r*sin(theta) ); } What is missing is a NonseparableTransformation class, developed along the lines of the SeparableTransformation, which utilizes a FuncXY rather than funcx and funcy. If you are not comfortable with c++ and the pycxx extension generator package, I would be happy to add this part. The polar axes would set a NonseparableTransformation with the FuncXY set to PolarXY. Roberto> A few more details would be great. As I said, I'm still Roberto> looking at the code and getting used to how things Roberto> work. I would be very happy to contribute with Roberto> matplotlib, it's a fantastic work and something that was Roberto> missing in the Python world for quite a long time. Great - I've been a bit out of the loop over the last week and will be playing catch-up this week, but will try and get the transform stuff into CVS for you ASAP so you can work on this. Thanks, JDH |