Ask Your Question
1

I want to display the origin on the graph.

asked 2021-07-16 04:35:02 +0200

fukui gravatar image

updated 2021-07-19 03:20:17 +0200

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 flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2021-07-16 11:00:05 +0200

tmonteil gravatar image

updated 2021-07-19 11:25:51 +0200

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

Of course, you can adapt:

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

Comments

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

fukui gravatar imagefukui ( 2021-07-19 03:27:06 +0200 )edit

I edited my answer.

tmonteil gravatar imagetmonteil ( 2021-07-19 22:54:23 +0200 )edit

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: 2021-07-16 04:35:02 +0200

Seen: 193 times

Last updated: Jul 19 '21