Ask Your Question
4

2d plot axes labels

asked 12 years ago

brenogil gravatar image

updated 10 years ago

FrédéricC gravatar image

Hello,

How do I add labels (names) to my axes when doing a simple 2d plot such as:

t = var('t')
E(t)=(10.40*(1-exp(-0.25*t)))^2.81    
plot(E,t,(x,0,15))

I would like to do so the labels are aligned directly under the x axis and vertically over the y axis. Is there a way?

Preview: (hide)

2 Answers

Sort by » oldest newest most voted
4

answered 12 years ago

Jason Grout gravatar image

Or this may be what you want:

t = var('t')
E(t)=(10.40*(1-exp(-0.25*t)))^2.81    
plot(E,t,(x,0,15),frame=True,axes_labels=['$t$ axis','$E$ axis'],axes=False)
Preview: (hide)
link

Comments

This is quite close to what I was expecting. Thank you!

brenogil gravatar imagebrenogil ( 12 years ago )
1

answered 12 years ago

calc314 gravatar image

The following positions the labels at the ends of the axes.

plot(E,t,(x,0,15),axes_labels=['$t$ axis','$E$ axis'])

You could use the text command to position a label.

t = var('t')
E(t)=(10.40*(1-exp(-0.25*t)))^2.81    
p=plot(E,t,(x,0,15),axes_labels=['','$E$ axis'])
p+=text('$t$ axis',(8,-30),color='black')
show(p)

You may also be able to use matplotlib to get what you want.

Preview: (hide)
link

Comments

Thank you very much!

brenogil gravatar imagebrenogil ( 12 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

Stats

Asked: 12 years ago

Seen: 18,720 times

Last updated: Aug 15 '12