ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 19 Oct 2012 03:26:11 -0500put title on matrix_plothttp://ask.sagemath.org/question/9444/put-title-on-matrix_plot/I am using matrix_plot to show an image. I would like to put a title on top of the plot.
Unfortunately the result looks unsatisfactory.
Is there a preferred way to put a title to matrix_plot?
piclabels = ('width [px]','height [px]')
import scipy
data = scipy.lena()
matrix_plot(data,axes_labels=piclabels, title='Lena image')
Due to lack of karma, I cannot attach an image show that the title is overlapping with the axis.Fri, 19 Oct 2012 01:06:13 -0500http://ask.sagemath.org/question/9444/put-title-on-matrix_plot/Answer by kcrisman for <p>I am using matrix_plot to show an image. I would like to put a title on top of the plot.
Unfortunately the result looks unsatisfactory.
Is there a preferred way to put a title to matrix_plot?</p>
<pre><code>piclabels = ('width [px]','height [px]')
import scipy
data = scipy.lena()
matrix_plot(data,axes_labels=piclabels, title='Lena image')
</code></pre>
<p>Due to lack of karma, I cannot attach an image show that the title is overlapping with the axis.</p>
http://ask.sagemath.org/question/9444/put-title-on-matrix_plot/?answer=14162#post-id-14162This must be pretty new functionality, because in Sage 5.2
verbose 0 (138: primitive.py, options) WARNING: Ignoring option 'title'=Lena image
and indeed there is no title. In Sage 5.3 we have the following picture, as you point out.
![image description](/upfiles/13506486229417517.png)
And it looks like [#10512: Jason Grout, Punarbasu Purkayastha, Sébastien Labbé: wrap matplotlib's title functionality [Reviewed by Sébastien Labbé, Punarbasu Purkayastha](http://trac.sagemath.org/sage_trac/ticket/10512) is what happened here - it adds the functionality, but didn't realize that with `matrix_plot` you will get stuff like this. But compare
sage: matrix_plot(data,axes_labels=piclabels, title='Lena image',origin='lower')
![image description](/upfiles/13506490462189825.png)
So I think that this will be pretty easy to fix by moving the title like we do for regular plots. I've opened [Trac 13625](http://trac.sagemath.org/sage_trac/ticket/13625) for this.Fri, 19 Oct 2012 02:22:48 -0500http://ask.sagemath.org/question/9444/put-title-on-matrix_plot/?answer=14162#post-id-14162Comment by elcojon for <p>This must be pretty new functionality, because in Sage 5.2</p>
<pre><code>verbose 0 (138: primitive.py, options) WARNING: Ignoring option 'title'=Lena image
</code></pre>
<p>and indeed there is no title. In Sage 5.3 we have the following picture, as you point out.</p>
<p><img alt="image description" src="/upfiles/13506486229417517.png"/></p>
<p>And it looks like [#10512: Jason Grout, Punarbasu Purkayastha, Sébastien Labbé: wrap matplotlib's title functionality <a href="http://trac.sagemath.org/sage_trac/ticket/10512">Reviewed by Sébastien Labbé, Punarbasu Purkayastha</a> is what happened here - it adds the functionality, but didn't realize that with <code>matrix_plot</code> you will get stuff like this. But compare</p>
<pre><code>sage: matrix_plot(data,axes_labels=piclabels, title='Lena image',origin='lower')
</code></pre>
<p><img alt="image description" src="/upfiles/13506490462189825.png"/></p>
<p>So I think that this will be pretty easy to fix by moving the title like we do for regular plots. I've opened <a href="http://trac.sagemath.org/sage_trac/ticket/13625">Trac 13625</a> for this.</p>
http://ask.sagemath.org/question/9444/put-title-on-matrix_plot/?comment=18844#post-id-18844Wow, that was fast. And the trac ticket tells us that this is already reported to mpl upstream.Fri, 19 Oct 2012 03:26:11 -0500http://ask.sagemath.org/question/9444/put-title-on-matrix_plot/?comment=18844#post-id-18844