Ask Your Question

Plot titles

asked 2010-12-11 18:22:02 -0500

Eviatar Bach gravatar image

updated 2010-12-12 01:25:56 -0500

niles gravatar image

I know about the text function, but this has to be inside the plot. How would one make titles for plots?

Thank you.

edit retag flag offensive close merge delete


actually, I was just wondering something similar -- I'd like to add a title to a GraphicsArray object

niles gravatar imageniles ( 2010-12-12 01:26:46 -0500 )edit

2 answers

Sort by ยป oldest newest most voted

answered 2010-12-12 06:07:49 -0500

Mike Witt gravatar image

I have sometimes used "convert" to add text to frames containing both 2d and 3d plots. I don't know if this is helpful or not, but It's the only way I know of to work with text on 3d animations (maybe someone can suggest a better way).

A code snippit:
# Need to move the frame file temporarily
move_cmnd = 'mv ' + filename + ' ' + filename + '_'
#print('move_cmnd: %s' %move_cmnd)
# This is the only way I can figure out to put text
# on a tachyon frame. You need to do it AFTER saving
# the frame above.
label = title
label += '  Seconds: %.4f' %times[time_index]
convert_cmnd = 'convert -font Helvetica -fill gray '
#convert_cmnd = 'convert -font Courier -fill gray '
#convert_cmnd = 'convert -font Bookman-Light -fill gray '
convert_cmnd += '-stroke gray -pointsize 16 '
convert_cmnd += '-draw \'text 100,50 '
convert_cmnd += '"' + label + '"' +'\''
convert_cmnd += ' ' + filename + '_ ' + filename
#print('convert_cmnd: %s'%convert_cmnd)
del_cmnd = 'rm -f ' + filename + '_'
#print('del_cmnd: %s'%del_cmnd)
edit flag offensive delete link more

answered 2010-12-21 21:02:43 -0500

Jason Grout gravatar image

We should wrap the matplotlib title option to plots. This would be a pretty straightforward thing to do. I've made it trac #10512. Note that you could always explicitly use a text object to make a title, but it's a little awkward.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2010-12-11 18:22:02 -0500

Seen: 436 times

Last updated: Dec 21 '10