#13078: Make it easier to do custom tick formatting
---------------------------+------------------------------------------------
   Reporter:  kcrisman     |             Owner:  jason, was
       Type:  enhancement  |            Status:  new       
   Priority:  minor        |         Milestone:  sage-5.1  
  Component:  graphics     |          Keywords:            
Work issues:               |   Report Upstream:  N/A       
  Reviewers:               |           Authors:            
  Merged in:               |      Dependencies:            
   Stopgaps:               |  
---------------------------+------------------------------------------------
 [https://groups.google.com/forum/?fromgroups#!topic/sage-
 support/pQ3RHcyLRPM This sage-support thread] raised the interesting
 question of having not just custom ticks, but then custom formatting of
 said ticks one-by-one (say, setting the ticks but wanting them labeled
 `x_0`, `x_1`, etc.).

 User "ObsessiveMathsFreak" contributed the following code there.
 {{{
 ==========================

 def plot_labels(x_ticks,x_labels,y_ticks,y_labels,fontsize=12):
     import matplotlib.ticker
     def latex_ticklabels(lbls_x,lbls_y):
         return
 
[matplotlib.ticker.FixedFormatter(lbls_x),matplotlib.ticker.FixedFormatter(lbls_y)]

     ft=fontsize
     return
 
plot([],ticks=[x_ticks,y_ticks],tick_formatter=latex_ticklabels(x_labels,y_labels),fontsize=ft)



 
PL=plot_labels([1,3],["$x_1$","$x_2$"],[1,2,3.5],["$y_1$","$y_2$","$y_3$"],fontsize=15)

 P0=plot(x,(x,0,2))
 P1=plot(x^2,(x,0,4))

 show(P0+PL)
 show(P1+PL)

 ==========================

 I hope this is useful
 }}}

 Maybe there is a way we can work that into our tick and formatting
 framework.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13078>
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