ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 22 Dec 2010 04:02:43 +0100Plot titleshttps://ask.sagemath.org/question/7808/plot-titles/I know about the text function, but this has to be inside the plot. How would one make titles for plots?
Thank you.Sun, 12 Dec 2010 01:22:02 +0100https://ask.sagemath.org/question/7808/plot-titles/Comment by niles for <p>I know about the text function, but this has to be inside the plot. How would one make titles for plots?</p>
<p>Thank you.</p>
https://ask.sagemath.org/question/7808/plot-titles/?comment=22423#post-id-22423actually, I was just wondering something similar -- I'd like to add a title to a GraphicsArray objectSun, 12 Dec 2010 08:26:46 +0100https://ask.sagemath.org/question/7808/plot-titles/?comment=22423#post-id-22423Answer by Mike Witt for <p>I know about the text function, but this has to be inside the plot. How would one make titles for plots?</p>
<p>Thank you.</p>
https://ask.sagemath.org/question/7808/plot-titles/?answer=11853#post-id-11853I 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:
<pre>
frame.save(filename)
# Need to move the frame file temporarily
move_cmnd = 'mv ' + filename + ' ' + filename + '_'
#print('move_cmnd: %s' %move_cmnd)
os.system(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)
os.system(convert_cmnd)
del_cmnd = 'rm -f ' + filename + '_'
#print('del_cmnd: %s'%del_cmnd)
os.system(del_cmnd)
</pre>Sun, 12 Dec 2010 13:07:49 +0100https://ask.sagemath.org/question/7808/plot-titles/?answer=11853#post-id-11853Answer by Jason Grout for <p>I know about the text function, but this has to be inside the plot. How would one make titles for plots?</p>
<p>Thank you.</p>
https://ask.sagemath.org/question/7808/plot-titles/?answer=11894#post-id-11894We should wrap the matplotlib title option to plots. This would be a pretty straightforward thing to do. I've made it [trac #10512](http://trac.sagemath.org/sage_trac/ticket/10512). Note that you could always explicitly use a text object to make a title, but it's a little awkward.Wed, 22 Dec 2010 04:02:43 +0100https://ask.sagemath.org/question/7808/plot-titles/?answer=11894#post-id-11894