Ask Your Question
2

put title on matrix_plot

asked 2012-10-19 08:06:13 +0100

elcojon gravatar image

updated 2012-10-19 08:07:20 +0100

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.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2012-10-19 09:22:48 +0100

kcrisman gravatar image

This 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

And it looks like [#10512: Jason Grout, Punarbasu Purkayastha, Sébastien Labbé: wrap matplotlib's title functionality Reviewed by Sébastien Labbé, Punarbasu Purkayastha 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

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 for this.

edit flag offensive delete link more

Comments

Wow, that was fast. And the trac ticket tells us that this is already reported to mpl upstream.

elcojon gravatar imageelcojon ( 2012-10-19 10:26:11 +0100 )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

Stats

Asked: 2012-10-19 08:06:13 +0100

Seen: 1,827 times

Last updated: Oct 19 '12