#13625: matrix_plot and title don't mix well (yet)
----------------------------+-----------------------------------------------
       Reporter:  kcrisman  |         Owner:  jason, was
           Type:  defect    |        Status:  new       
       Priority:  major     |     Milestone:  sage-5.5  
      Component:  graphics  |    Resolution:            
       Keywords:            |   Work issues:            
Report Upstream:  N/A       |     Reviewers:            
        Authors:            |     Merged in:            
   Dependencies:            |      Stopgaps:            
----------------------------+-----------------------------------------------

Old description:

> See [http://ask.sagemath.org/question/1888/put-title-on-matrix_plot this
> ask.sagemath.org question], where elcojon gives this example.
> {{{
> piclabels = ('width [px]','height [px]')
> import scipy
> data = scipy.lena()
> matrix_plot(data,axes_labels=piclabels, title='Lena image')
> }}}
> [[Image(Lena-wrongtitle.png)]]
>
> This is fallout from the great ''new'' functionality in #10512.

New description:

 See [http://ask.sagemath.org/question/1888/put-title-on-matrix_plot this
 ask.sagemath.org question], where elcojon gives this example.
 {{{
 piclabels = ('width [px]','height [px]')
 import scipy
 data = scipy.lena()
 matrix_plot(data,axes_labels=piclabels, title='Lena image')
 }}}
 [[Image(Lena-wrongtitle.png)]]

 This is fallout from the great ''new'' functionality in #10512. The
 `axes_labels` are irrelevant to whether this happens.

--

Comment (by kcrisman):

 Indeed, the following fixes the problem (though probably introduces
 others!)
 {{{
 #!diff
 diff --git a/sage/plot/graphics.py b/sage/plot/graphics.py
 --- a/sage/plot/graphics.py
 +++ b/sage/plot/graphics.py
 @@ -2460,11 +2460,8 @@
          # free limits autoscale
          #subplot.autoscale_view(tight=True)
          if title is not None:
 -            if (frame) or (axes_labels is None):
 -                subplot.set_title(title, fontsize=fontsize)
 -            else: # frame is false axes is not None, and neither is
 axes_labels
 -                # Then, the title is moved up to avoid overlap with axes
 labels
 -                subplot.set_title(title, fontsize=fontsize,
 position=(0.5,1.05))
 +            # Then, the title is moved up to avoid overlap with axes
 labels
 +            subplot.set_title(title, fontsize=fontsize,
 position=(0.5,1.05))
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13625#comment:5>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to