First time here? Check out the FAQ!

Ask Your Question
1

are pi tick marks not supported in sagetex

asked 7 years ago

alienfetuseater gravatar image

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}
Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 7 years ago

kcrisman gravatar image

I 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.

Preview: (hide)
link

Comments

oh cool thank you so much random sagemath person !

alienfetuseater gravatar imagealienfetuseater ( 7 years ago )
1

Nothing random about it :-) but you are very welcome.

kcrisman gravatar imagekcrisman ( 7 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 7 years ago

Seen: 494 times

Last updated: Jun 05 '17