ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 09 Jun 2017 20:27:06 +0200are pi tick marks not supported in sagetexhttps://ask.sagemath.org/question/37794/are-pi-tick-marks-not-supported-in-sagetex/ as opposed to having integer tick marks on x-axis for plotting... the sagedocs show the following for a pi-axis
sage: g1 = plot(sin(x), 0, 2*pi)
sage: g2 = plot(cos(x), 0, 2*pi, linestyle="--")
sage: (g1+g2).show(ticks=pi/6, tick_formatter=pi)
but when i tried to impliment this with sagetex,as follows, it is auto converted to integer tick marks
\begin{sagesilent}
g1 = plot(sin(x), 0, 2*pi)
g2 = plot(cos(x), 0, 2*pi, linestyle="--")
(g1+g2).show(ticks=pi/6, tick_formatter=pi)
\end{sagesilent}
\sageplot[width = 1. \textwidth]{g1+g2}Mon, 05 Jun 2017 01:59:26 +0200https://ask.sagemath.org/question/37794/are-pi-tick-marks-not-supported-in-sagetex/Answer by kcrisman for <p>as opposed to having integer tick marks on x-axis for plotting... the sagedocs show the following for a pi-axis</p>
<pre><code>sage: g1 = plot(sin(x), 0, 2*pi)
sage: g2 = plot(cos(x), 0, 2*pi, linestyle="--")
sage: (g1+g2).show(ticks=pi/6, tick_formatter=pi)
</code></pre>
<p>but when i tried to impliment this with sagetex,as follows, it is auto converted to integer tick marks</p>
<pre><code>\begin{sagesilent}
g1 = plot(sin(x), 0, 2*pi)
g2 = plot(cos(x), 0, 2*pi, linestyle="--")
(g1+g2).show(ticks=pi/6, tick_formatter=pi)
\end{sagesilent}
\sageplot[width = 1. \textwidth]{g1+g2}
</code></pre>
https://ask.sagemath.org/question/37794/are-pi-tick-marks-not-supported-in-sagetex/?answer=37798#post-id-37798I have definitely used this exact thing, but I guess you need to do it directly within `sageplot`? That would be my guess as to your problem. Here is something I use which definitely works:
\sageplot[scale=.35]{plot(cos(x),(x,0,pi),fill=True,ticks = [[0,pi/2,pi],[-1,-1/2,0,1/2,1]],tick_formatter=[pi,None],fontsize=30)}
Actually, upon further reading, that is definitely the problem; you can't use `show()` within `sagesilent` because that returns `None`. The plot `g1+g2` doesn't have any of those other attributes. You *might* be able to put them in the definitions of the plots themselves.Mon, 05 Jun 2017 20:27:50 +0200https://ask.sagemath.org/question/37794/are-pi-tick-marks-not-supported-in-sagetex/?answer=37798#post-id-37798Comment by alienfetuseater for <p>I have definitely used this exact thing, but I guess you need to do it directly within <code>sageplot</code>? That would be my guess as to your problem. Here is something I use which definitely works:</p>
<pre><code>\sageplot[scale=.35]{plot(cos(x),(x,0,pi),fill=True,ticks = [[0,pi/2,pi],[-1,-1/2,0,1/2,1]],tick_formatter=[pi,None],fontsize=30)}
</code></pre>
<p>Actually, upon further reading, that is definitely the problem; you can't use <code>show()</code> within <code>sagesilent</code> because that returns <code>None</code>. The plot <code>g1+g2</code> doesn't have any of those other attributes. You <em>might</em> be able to put them in the definitions of the plots themselves.</p>
https://ask.sagemath.org/question/37794/are-pi-tick-marks-not-supported-in-sagetex/?comment=37883#post-id-37883oh cool thank you so much random sagemath person !Fri, 09 Jun 2017 01:54:19 +0200https://ask.sagemath.org/question/37794/are-pi-tick-marks-not-supported-in-sagetex/?comment=37883#post-id-37883Comment by kcrisman for <p>I have definitely used this exact thing, but I guess you need to do it directly within <code>sageplot</code>? That would be my guess as to your problem. Here is something I use which definitely works:</p>
<pre><code>\sageplot[scale=.35]{plot(cos(x),(x,0,pi),fill=True,ticks = [[0,pi/2,pi],[-1,-1/2,0,1/2,1]],tick_formatter=[pi,None],fontsize=30)}
</code></pre>
<p>Actually, upon further reading, that is definitely the problem; you can't use <code>show()</code> within <code>sagesilent</code> because that returns <code>None</code>. The plot <code>g1+g2</code> doesn't have any of those other attributes. You <em>might</em> be able to put them in the definitions of the plots themselves.</p>
https://ask.sagemath.org/question/37794/are-pi-tick-marks-not-supported-in-sagetex/?comment=37891#post-id-37891Nothing random about it :-) but you are very welcome.Fri, 09 Jun 2017 20:27:06 +0200https://ask.sagemath.org/question/37794/are-pi-tick-marks-not-supported-in-sagetex/?comment=37891#post-id-37891