Sorry about the replys above. This new Google groups interface is really
confusing.
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
On Friday, June 1, 2012 4:22:13 PM UTC+1, ObsessiveMathsFreak wrote:
>
> While the "ticks=" option in plot can be used to place custom tick marks
> on plot axes, how would you go about putting custom labels on each tick
> mark, preferably latex ones,. e.g. $x_0$, $x_1$, etc.
>
> Is there a way of doing this automatically, given a list of ticks and
> labels?
>
>
On Friday, June 1, 2012 4:22:13 PM UTC+1, ObsessiveMathsFreak wrote:
>
> While the "ticks=" option in plot can be used to place custom tick marks
> on plot axes, how would you go about putting custom labels on each tick
> mark, preferably latex ones,. e.g. $x_0$, $x_1$, etc.
>
> Is there a way of doing this automatically, given a list of ticks and
> labels?
>
>
--
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