Ask Your Question
2

put title on matrix_plot

asked 12 years ago

elcojon gravatar image

updated 12 years ago

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.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
2

answered 12 years ago

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.

Preview: (hide)
link

Comments

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

elcojon gravatar imageelcojon ( 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: 1,855 times

Last updated: Oct 19 '12