I want to display the origin on the graph.

I'm displaying the graph of a function as follows:

d = 2
n = 1
psi(x)  = sqrt(2.0/d)*sin(n*pi*x/d)
graph  = plot(abs(psi(x))^2, 0, d, figsize=5, axes_labels=['$x$', '$|\psi_{1}(x)|^2$'])
graph.show()


I want to display "o" at the origin. Is there no choice but to display it in text as shown below?

text('o', (-1, -1))

edit retag close merge delete

Sort by » oldest newest most voted

Could you please make your question more precise ? The origin is located at the intersection of the axes:

sage: graph + arrow2d((-0.4,-0.4),(-0.02,-0.02), color='red')


If you want to add a point at the origin, you can do:

sage: graph + point2d((0,0), size=50, color='black')


EDIT as shown as before, you can add graphics together, including the one produced by text:

sage: graph + text('o', (-1, -1))
Launched png viewer for Graphics object consisting of 2 graphics primitives


sage: graph + text('0', (-0.1, -0.05), color='black')
Launched png viewer for Graphics object consisting of 2 graphics primitives

more

I'm sorry for the vague question. I have corrected the question, so please answer again if you like.

( 2021-07-19 03:27:06 +0100 )edit

( 2021-07-19 22:54:23 +0100 )edit