On Tue, Sep 1, 2009 at 4:11 PM, Jason Grout <jason-s...@creativetrax.com>wrote:
> > I've recently been working with Karl-Dieter on shifting our axes and > gridline functionality over to the corresponding matplotlib functions, > and exposing the matplotlib object a bit better. I think we are to the > point where we can use comments and a vote on a new strategy for placing > axes. Since this affects some core functionality that is used by lots > of people (especially by lots of non-developers), testing and feedback > is crucial. > > You can try this patch out by applying the second patch at #5448: > > http://trac.sagemath.org/sage_trac/raw-attachment/ticket/5448/trac-5448-matplotlib-axes-gridlines.patch > > You will also need to install two new spkgs: > > http://sage.math.washington.edu/home/jason/matplotlib-0.99.0.spkg > > > http://sage.math.washington.edu/home/jason/networkx-0.99.p1-fake_really-0.36.p1.spkg > (this is to take care of some deprecations introduced by the new > matplotlib spkg) > > I've posted up a bunch of examples from the doctests at > http://sage.math.washington.edu/home/jason/newgraphics.pdf, so you can > see what we are talking about even without installing anything. > > If you want a couple of reasons why we should delete our axes and > gridlines code and instead shift that functionality to matplotlib, read > the next section. If you just want to see and vote on the proposal for > axes placement, skip down to the bottom of this message. > > Moving things to matplotlib > ================================ > > A common complaint is that our axes cross at nonstandard points, > seemingly at random. This is compounded by the ticks not always being > labeled on the axes. Even though people have been complaining about > this for years, no one (or at least, *very* few people) have touched the > axes code. It seems pretty unmaintained at this point---I know I'm > afraid to touch it and I think I'm as comfortable as almost anyone with > most of the 2d graphics code. > > Contrast this to matplotlib, the project upon which our 2d graphics are > based, and which is the gold standard for python graphics. This project > is very actively maintained and used by lots and lots of people in the > scientific python community. In the most recent release of matplotlib, > capability was added to draw axes in the middle of the picture. One of > the goals of the patch above is to shift as much of our functionality as > possible over to matplotlib so we don't have to maintain the code. > Another *huge* benefit we get from this is that we can do much more > advanced things with graphics. On occasion, people have asked if they > could do more advanced things with Sage graphics, and because we do so > much on our own, they have to basically drop Sage and work directly with > matplotlib. With this patch, they will be able to construct a graphic > in Sage, then ask for that graphic as a matplotlib figure, and then be > able to use the many tools of matplotlib to extensively tweak their > graphic. Because we would be using standard matplotlib tools for axes > and gridlines, there is no loss moving to matplotlib from Sage to finish > tweaking a graph. > > I think gridlines is another area that is wonderful to have, but we're > increasing the amount of code that we need to maintain, while similar > functionality is offered from matplotlib. Furthermore, there are some > people doing active development in curvilinear coordinates and grids in > matplotlib, which we can take advantage of if we move our gridlines to > use matplotlib gridlines. > > > > Proposal for axes placement > =========================== > > Here is a consistent strategy for drawing axes on a graphic. This comes > out of discussions with Mike Hansen and maybe some others at the Sage > Days in January. > > x-axis > ------ > > * If the line y=0 is in the picture, draw the x-axis there. > > * If the picture is entirely in the upper half-plane, draw the x-axis on > the bottom of the picture, offset below the picture just a bit to > indicate that it is not the line y=0. > > * If the picture is entirely in the lower half-plane, draw the x-axis on > the top of the picture, offset above the picture just a bit to indicate > that it is not the line y=0. > > > y-axis > ------ > > * If the line x=0 is in the picture, draw the y-axis there. > > * If the picture is entirely in the right half-plane, draw the y-axis on > the left of the picture, offset to the left of the picture just a bit to > indicate that it is not the line x=0. > > * If the picture is entirely in the left half-plane, draw the y-axis on > the right of the picture, offset to the right of the picture just a bit > to indicate that it is not the line x=0. > > frames and axes > --------------- > > * If both frames and axes are wanted, then draw the frame and the lines > y=0 and x=0 (if they are visible) > > You can see pictures of these in the first few pages of > http://sage.math.washington.edu/home/jason/newgraphics.pdf > > There are several nice things about this: > > 1. The axes only ever cross at the origin, so there is no confusion > > 2. You can instantly tell what quadrant(s) the picture is in, based on > where the axes are around the picture. > > The more I have played with this, the more I really, really like it. > > So, what do you think? Yes or no? > I mainly only looked over the examples, but I think this is a "no brainer" yes. The current axes system is not very good, and it is a constant source of confusion and emails on sage-support. The sooner it is replaced by what you've done, the better. -- William --~--~---------~--~----~------------~-------~--~----~ To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---