#9578: Add even more customization of ticks in plots
---------------------------+------------------------------------------------
   Reporter:  kcrisman     |       Owner:  jason, was
       Type:  enhancement  |      Status:  new       
   Priority:  minor        |   Milestone:  sage-4.5.2
  Component:  graphics     |    Keywords:            
     Author:               |    Upstream:  N/A       
   Reviewer:               |      Merged:            
Work_issues:               |  
---------------------------+------------------------------------------------
 Such as arbitrary ticks, color... Here are some hints for this from
 [http://groups.google.com/group/sage-
 
devel/browse_thread/thread/64aee5700d4f7ff4/34a82a725be9e2a5?show_docid=34a82a725be9e2a5
 sage-devel]
 {{{
 > I figure with some polishing it could go into Sage. Part of that
 > polishing would require to figure out how one can make
 > sage: pylab.clf()
 > sage: _ = pylab.pcolor(pylab.rand(2,2))
 > sage: pylab.savefig('foo.png',dpi=96)
 > not print out indices for x and y from 0 to n but from a to b. I
 > couldn't figure this out. Maybe someone on this list knows from the
 > top of the head?


 Here's one way to do it, just by changing the tick labels.  There are
 other more flexible ways too:
 sage: import pylab
 sage: pylab.clf()
 sage: p = pylab.pcolor(pylab.rand(2,2))
 sage: p.axes.get_xticks() # see what ticks are in the plot
 array([ 0. ,  0.5,  1. ,  1.5,  2. ])
 sage: _=p.axes.set_xticklabels(['0','1000','2000','3000','4000'])
 sage: pylab.savefig('foo.png',dpi=96)
 Or if you just want to multiply each tick label by a certain amount:
 sage: _=p.axes.set_xticklabels([str(i) for i in 1000*p.axes.get_xticks()])
 sage: pylab.savefig('foo.png',dpi=96)
 Thanks,
 Jason
 }}}
 and
 {{{
 Yes, I think it would be pretty easy.  Note that matplotlib just added
 some nice convenience functions for dealing with changing the styles of
 ticks too, so we could easy change the colors or weights or whatever as
 well.
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9578>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to