Ask Your Question
0

Label each point

asked 9 years ago

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

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 9 years ago

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()
Preview: (hide)
link

Comments

very nice! thank you!

mellow_yellow gravatar imagemellow_yellow ( 9 years ago )

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: 9 years ago

Seen: 2,421 times

Last updated: Jul 19 '15