You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Section PF1 and maybe elsewhere, there are a bunch of trig graphs with tick marks labeled things like $\frac{1}{2} \pi$. But in looking at one of the images in Calculus CO-4 I figured out how to get these to typeset as $\frac{\pi}{2}$. We should copy that idea over to make the other graphs look nicer.
The text was updated successfully, but these errors were encountered:
Key insight from the Sage documentation: "Custom tick labels can be provided by providing the keyword tick_formatter with the list of labels, and simultaneously providing the keyword ticks with the positions of the labels."
Wired this up into a quick proof of concept
Old image:
New image:
Code:
f(x) = sin(x)
p=Graphics()
xmin=-2*pi
xmax=4*pi
delta=pi/4
custom_ticks=[]
custom_tick_labels=[]
for x in [xmin+delta*i for i in [0.. int((xmax-xmin)/delta)]]:
if denominator(x) != 1:
custom_tick_labels.append(f"$\\dfrac{{{latex(numerator(x))}}}{{{denominator(x)}}}$")
custom_ticks.append(x)
else:
custom_ticks.append(x)
custom_tick_labels.append(f"${latex(x)}$")
p+=plot(f, (x, xmin, xmax), color='blue', thickness=3, detect_poles=True,ticks=[custom_ticks,0.5], tick_formatter=[custom_tick_labels,"latex"])
show(p)
Probably the "right" thing to do is factor this into a function in our common.sage
In Section PF1 and maybe elsewhere, there are a bunch of trig graphs with tick marks labeled things like$\frac{1}{2} \pi$ . But in looking at one of the images in Calculus CO-4 I figured out how to get these to typeset as $\frac{\pi}{2}$ . We should copy that idea over to make the other graphs look nicer.
The text was updated successfully, but these errors were encountered: