i am looking for a way to display just special values on the x-axis in a plot of a function on SageMath. (e.g. 0, pi/4, pi/2, 3pi/4, pi, ...)
Any suggestions?
i am looking for a way to display just special values on the x-axis in a plot of a function on SageMath. (e.g. 0, pi/4, pi/2, 3pi/4, pi, ...)
Any suggestions?
The SageMath plotting documentation
has examples of using ticks and tick_formatter.
They allow plots like the following:
sage: ticks = [pi/6, sorted({sin(a) for a in [0, pi/6 .. 2*pi]})]
sage: p = plot(sin, 0, 2*pi, ticks=ticks, tick_formatter=pi)
sage: p
Launched png viewer for Graphics object consisting of 1 graphics primitive
To save the plot:
sage: p.save('sine_function_plot.png', figsize=5)