#9740: matrix plot is upside down and should wrap more matplotlib options
---------------------------+------------------------------------------------
Reporter: jason | Owner: jason, was
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-4.6
Component: graphics | Keywords:
Author: Jason Grout | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
---------------------------+------------------------------------------------
Comment(by jason):
Replying to [comment:19 kcrisman]:
> Replying to [comment:18 kcrisman]:
> > Explain `axes_integer`.
> > Explain
> > {{{
> > limits[k]-=0.5
> > }}}
> > I assume this makes it so that the matrix has `0,1,2,3` as opposed to
putting entries between `0-1`, `1-2`, etc. I can't check this because the
branch I'm making for this decided to rebuild documentation, which takes a
while... sigh.
>
> Okay, I think that these two things combine to make this happen, after
reading
[http://matplotlib.sourceforge.net/api/ticker_api.html#matplotlib.ticker.MaxNLocator
this] again.
>
> I still don't know if I like sparse and dense matrices looking so
different. So the idea is that the little circle points indicate sparse,
while the boxes indicate dense? I'm thinking of
> {{{
> sage: b=random_matrix(GF(2),12,sparse=True,density=0.99)
> sage: matrix_plot(b)
>
> sage: b=random_matrix(GF(2),12,density=0.99)
> sage: matrix_plot(b)
> }}}
Yes; you can choose the marker used in sparse matrices. Aside from the
fact that this is a fundamental difference in matplotlib, it does also
make sense. In dense matrices, most entries are nonzero, so you color
every pixel/square. In sparse matrices, most entries are zero, so you
only put a marker where there is a nonzero.
>
> Also, my favorite use case doesn't work yet, though to be fair it didn't
work before, so this shouldn't hold things up (and is a currently open
ticket). But just in case, is there a quick way to get this now? After
all, one might want the first row to be labeled 1 sometimes!
> {{{
> sage: M = matrix(ZZ,[[1,2,3,4],[1,4,9,16],[1,8,27,64]])
> sage: matrix_plot(M)
> sage: matrix_plot(M,ticks=[1,2,3,4])
> ERROR: An unexpected error occurred while tokenizing input
> <snip>
> 1992
> 1993 from matplotlib.ticker import OldScalarFormatter,
MaxNLocator, MultipleLocator, FixedLocator, NullLocator, Locator
> -> 1994 x_locator, y_locator = ticks
> 1995 if x_locator is None:
> 1996 x_locator = MaxNLocator(**locator_options)
>
> ValueError: too many values to unpack
> }}}
Yes, definitely another ticket.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9740#comment:22>
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.