Ask Your Question

Label each point

asked 2015-07-19 01:04:48 -0500

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

answered 2015-07-19 15:30:25 -0500

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')
edit flag offensive delete link more


very nice! thank you!

mellow_yellow gravatar imagemellow_yellow ( 2015-07-20 09:02:25 -0500 )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


Asked: 2015-07-19 01:04:48 -0500

Seen: 855 times

Last updated: Jul 19 '15