[sage-devel] Re: New graphics axes and gridlines

2009-09-05 Thread Jason Grout

Stan Schymanski wrote:
 Hi Jason,
 
 Thanks for the great work!
 
 Just to add to the axis labels problem you mentioned, the following
 does not display the y-axis label for me (in notebook):
 
 P = plot(1.5*x + 0.003,(x,0,0.075))
 P.axes_labels(['$\delta_c$ (m)', '$\delta_h$ (m)'])
 P
 
 Changing the xmax value a little bit makes it work fine again:
 
 P = plot(1.5*x + 0.003,(x,0,0.05))
 P.axes_labels(['$\delta_c$ (m)', '$\delta_h$ (m)'])
 P


I believe I've now taken care of all outstanding issues with this patch, 
including the one that you mention.

Now we just need a final review!

Again, to test, just:

* install 
http://sage.math.washington.edu/home/jason/matplotlib-0.99.0.spkg and 
http://sage.math.washington.edu/home/jason/networkx-0.99.p1-fake_really-0.36.p1.spkg
 


* If you have 4.1.1 (i.e., not 4.1.2.alpha0), then apply the patch at #6685

* Then apply trac-5448-matplotlib-axes-gridlines.4.patch from 
http://trac.sagemath.org/sage_trac/ticket/5448

Doctests pass in plot/*.py.  Docbuild also passes.

Enjoy!

Jason


-- 
Jason Grout


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[sage-devel] Re: New graphics axes and gridlines

2009-09-02 Thread kcrisman


 Anyway, thanks again for all of your hard work on this!  Sage has come a
 long ways because of it.

+1. As thick as the web of the current plot code is, the actual
functioning is very good in nearly all normal cases, as witness how
picky we can afford to be with matplotlib; doing that from scratch is
monumental.  I suppose without good plotting I wouldn't have used Sage
at all - nor would many others coming from the educational side.
Thanks!

- kcrisman
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[sage-devel] Re: New graphics axes and gridlines

2009-09-02 Thread Stan Schymanski

Hi Jason,

Thanks for the great work!

Just to add to the axis labels problem you mentioned, the following
does not display the y-axis label for me (in notebook):

P = plot(1.5*x + 0.003,(x,0,0.075))
P.axes_labels(['$\delta_c$ (m)', '$\delta_h$ (m)'])
P

Changing the xmax value a little bit makes it work fine again:

P = plot(1.5*x + 0.003,(x,0,0.05))
P.axes_labels(['$\delta_c$ (m)', '$\delta_h$ (m)'])
P

Cheers,
Stan


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[sage-devel] Re: New graphics axes and gridlines

2009-09-02 Thread Jason Grout

Stan Schymanski wrote:
 Hi Jason,
 
 Thanks for the great work!
 
 Just to add to the axis labels problem you mentioned, the following
 does not display the y-axis label for me (in notebook):
 
 P = plot(1.5*x + 0.003,(x,0,0.075))
 P.axes_labels(['$\delta_c$ (m)', '$\delta_h$ (m)'])
 P
 
 Changing the xmax value a little bit makes it work fine again:
 
 P = plot(1.5*x + 0.003,(x,0,0.05))
 P.axes_labels(['$\delta_c$ (m)', '$\delta_h$ (m)'])
 P


Are you using the latest version of the patch?  I updated the patch just 
before posting to sage-devel.

Now that the word is out, I'll make explicitly named versions of the 
patch when I make a change.


Thanks,

Jason


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[sage-devel] Re: New graphics axes and gridlines

2009-09-01 Thread Jason Grout

Jason Grout 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


I should mention a few problems with this patch currently:

1. if the axis is on the top or the right, axis labels are messed up 
(they appear on the bottom or right, respectively).  This is possibly a 
bug in matplotlib.  We expect some sort of resolution in the next few days.

2. Lines and scatter plot circles are clipped because the line width and 
circle radius are not taken into account when adjusting axis limits. 
Should we automatically change axis limits just a bit to include the 
line width and circle radius, or should we just not clip these?  Not 
clipping them looks bad when you have frame axes, since then part of 
your line extends beyond the frame.  Not clipping also looks bad when 
you artificially limit your axes (i.e., using ymin and ymax), since the 
line is drawn anyway outside of the axes.

Does anyone find anything else???

Jason


-- 
Jason Grout


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[sage-devel] Re: New graphics axes and gridlines

2009-09-01 Thread William Stein
On Tue, Sep 1, 2009 at 4:11 PM, Jason Grout jason-s...@creativetrax.comwrote:


 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 

[sage-devel] Re: New graphics axes and gridlines

2009-09-01 Thread Jason Grout

Alex Clemesha wrote:
 Jason,
 
 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.
 Thank you so much for putting in this effort!! When I wrote most of
 the axes code, over 3 years ago, matplotlib was considerable less
 amazing than it is now.  Today it is a quite impressive, well thought-out,
 and mature project.
 
 I fully support moving as moved code as possible to use matplotlib,
 and I greatly appreciate the fact that you are taking the initiative to
 do so.

I should emphasize again that I really, *really* appreciate the people 
that wrote so much code that is in Sage to do graphics.  You're right 
that matplotlib has grown quite a bit.  For example, it was only in the 
last release that it developed the capability to easily display axes in 
the middle of the plot.

Anyway, thanks again for all of your hard work on this!  Sage has come a 
long ways because of it.

Jason

-- 
Jason Grout


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---