#20026: Reverse the scale of colors in Matrix.plot
-------------------------+-------------------------------------------------
       Reporter:         |        Owner:
  ncohen                 |       Status:  needs_info
           Type:         |    Milestone:  sage-7.1
  enhancement            |   Resolution:
       Priority:  major  |    Merged in:
      Component:         |    Reviewers:  Jori Mäntysalo
  linear algebra         |  Work issues:
       Keywords:         |       Commit:
        Authors:         |  791fe5552026c199a7ce575bc594a8e705972549
  Nathann Cohen          |     Stopgaps:
Report Upstream:  N/A    |
         Branch:         |
  public/20026           |
   Dependencies:         |
-------------------------+-------------------------------------------------

Comment (by kcrisman):

 Ok, here is a question.  What should we expect about these?
 {{{
 sage: matrix([[0,0,],[1,1]]).plot()
 sage: matrix([[-1,-1],[1,1]]).plot()
 sage: matrix([[-10,-10],[0,0]]).plot()
 sage: matrix([[0,0],[0,0]]).plot()
 sage: matrix([[-100,0],[100,0]]).plot()
 }}}

 As to modifying documentation, I think it would be good to be more
 specific about the default here (writing for the current)

 {{{
     If the matrix is dense, each matrix element is given a different
     color value depending on its relative size compared to the other
     elements in the matrix.
 +   The default is for the lowest number to be black and the highest
 +   number to be white in a greyscale pattern; see the information about
 +   normalizing below.
 }}}
 One could add
 {{{
 +   To achieve the lowest number to be white and the highest black, use
 +   `cmap='Greys'` (see below for syntax).
 }}}
 or whatever is appropriate.  Similarly, with the sparse matrices it would
 be super-helpful to say why the "unexpected" is done - compatibility with
 matplotlib/matlab.

 I can document whatever we do once we agree on something, since it appears
 that no one on sage-devel cares about this, so hopefully we can find a
 consensus here.  But I am not really sure there is an "obvious" answer for
 the last matrix.  See also the `norm` and `vmin` and `vmax`, e.g.
 {{{
 sage: matrix([[-100,0],[100,0]]).plot(norm='value')
 <three black squares, currently>
 }}}

 Or even compare
 {{{
 sage: matrix([[-10,0],[0,10]],sparse=True).plot()
 sage: matrix([[-10,0],[0,10]],sparse=False).plot() # current default
 sage: matrix([[-10,0],[0,10]],sparse=False).plot(cmap='Greys') # your
 suggestion
 }}}
 So I'm not really sure what to do about this, as the whole point of a
 scale is that it goes negative to positive.
 {{{
 sage: identity_matrix(10).plot() # agreed, not ideal
 sage: (-1*identity_matrix(10)).plot() # ?!#$$!
 }}}
 There is a fundamental discord between wanting things to behave like the
 sparse where zero is white, and wanting to be able to do a whole range
 from negative to positive.

 ----

 Also annoying but probably not worth doing on this ticket: `matrix_plot?`
 is helpful but `matrix().plot?` is not.

--
Ticket URL: <http://trac.sagemath.org/ticket/20026#comment:20>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to