Ask Your Question
0

Label each point

asked 2015-07-19 08:04:48 +0100

mellow_yellow gravatar image

Is it possible in Sage to label each point in a 2-D plot? I'd like to create something like this: image description

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2015-07-19 22:30:25 +0100

ndomes gravatar image
f(x) = (x-2)^2-9
P = [(x0,f(x0)) for x0 in [-2..6]]
G = plot(f,-2,6)
G += points(P)
for p in P:
    G += text('  (%s,%s)'%(p[0],p[1]),p,horizontal_alignment='left',color='red')
G.show()
edit flag offensive delete link more

Comments

very nice! thank you!

mellow_yellow gravatar imagemellow_yellow ( 2015-07-20 16:02:25 +0100 )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

1 follower

Stats

Asked: 2015-07-19 08:04:48 +0100

Seen: 2,173 times

Last updated: Jul 19 '15