On Friday, June 1, 2012 4:55:39 PM UTC-4, ObsessiveMathsFreak wrote:
>
> Sorry about the replys above. This new Google groups interface is really 
> confusing. 
>
>
Agreed!

 

> Anyway, I coded up a plot_labels function to make adding labels to plots a 
> little more modular.
>
> The function basically creates an empty axis with labels which can be 
> attached to other plots. Code follows:
> ==========================
>
> 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
>
>>
>>


I've opened http://trac.sagemath.org/sage_trac/ticket/13078 and put this 
code there, in the hope that it will be to someone later on.  Thanks!

-- 
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-support
URL: http://www.sagemath.org

Reply via email to