On 1/25/11 5:46 PM, Ryan Grout wrote:
On 01/25/2011 06:14 PM, Dox wrote:
Hi everyone,

Today I was writing a SAGE tip for my blog, about using customized
ticks in plots, and I realize that,

sage: p = plot(sin(x), (x, -7, 7), ticks=pi/2, tick_formatter=pi,
axes_labels=['$x$','$\\sin(x)$'], fontsize=14, color='red')

sage: p.save('/home/me/fig1.pdf')

sage: q = plot(2*x+1,(x,0,5),ticks=[[0,1,e,pi,sqrt(20)],
2],tick_formatter="latex")
sage: q.save('/home/me/fig2.pdf')

you need to specify the axis labeling in the p.save part. For example,

sage = p = plot(sin(x), (x, -7, 7), color='red')

sage: p.save('/home/me/fig1.pdf', ticks=pi/2, tick_formatter=pi,
axes_labels=['$x$','$\\sin(x)$'], fontsize=14)

This outputs the correct figure. I don't think plot passes the extra
parameters to .save, but does to .show. I've run into this before when I
was working on a paper. This is how I got around the issue.

That bug was just fixed: http://trac.sagemath.org/sage_trac/ticket/8632

It should work in the next version of Sage.


sage: p = plot(sin(x), (x, -7, 7), ticks=pi/2, tick_formatter=pi,
axes_labels=['$x$','$\\sin(x)$'], fontsize=14,
color='red').show(filename='/home/me/test_ticks.pdf')

An extra comment: Is it possible to write $\frac{3\pi}{2}#$ in the
ticks instead of $\frac{3}{2}\pi$ ? Just for the sake of compactness.


I believe we are just using Sage's default printing of expressions here:

sage: latex(3*pi/2)
\frac{3}{2} \, \pi

So maybe the issue should be taken care of in the symbolic expression latex code? Burcin: thoughts?

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

Reply via email to