Opened 9 years ago

Last modified 9 years ago

#10847 closed enhancement

matrix_plot can now plot subdivisions — at Version 6

Reported by: jason Owned by: jason, was
Priority: major Milestone: sage-4.7
Component: graphics Keywords:
Cc: rbeezer, kcrisman, ryan Merged in:
Authors: Jason Grout Reviewers: Karl-Dieter Crisman
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by kcrisman)

This patch makes matrix_plot learn about plotting subdivisions.


Apply attachment:trac-10847-matrix_plot-subdivisions.patch and attachment:trac_10847-reviewer.patch

Change History (8)

Changed 9 years ago by jason

comment:1 Changed 9 years ago by jason

  • Status changed from new to needs_review

I think this is ready for review. I was trying to create a graph like in the Wikipedia page on DCT (http://en.wikipedia.org/wiki/File:Dctjpeg.png), but we didn't support plotting matrix subdivisions and adding lines to a matrix plot was messing it up.

Well, it all works beautifully now, after this patch! :).

comment:2 Changed 9 years ago by jason

  • Cc ryan added

comment:3 follow-up: Changed 9 years ago by kcrisman

  • Reviewers set to Karl-Dieter Crisman
  • Status changed from needs_review to needs_work

This is such a great patch, really nicely put together and documented, everything. I really want to say positive review, except plotting sparse matrices now does not work.

sage: sparse = matrix(dict([((randint(0, 10), randint(0, 10)), 1) for i in xrange(100)])); matrix_plot(sparse)
<snip>
AttributeError: Unknown property subdivisions

I have no idea how to fix this - all the obvious things I tried, including adding to the list of options deleted for sparse plotting, or deleting this options after creating the lines, did not work. I must be missing something pretty obvious, I guess, but since this is one of the doctest examples it now fails the tests and obviously this needs work!

comment:4 in reply to: ↑ 3 Changed 9 years ago by rbeezer

Replying to kcrisman:

AttributeError?: Unknown property subdivisions

Matrices have a function subdivision() and an attribute subdivisions.

sage: A= matrix(2, range(4))
sage: type(A.subdivision)
<type 'builtin_function_or_method'>
sage: type(A.subdivisions)
<type 'NoneType'>

The latter should go away, see #4983. Maybe it is not visible outside of a *.pyx file?

Anyway, hope this helps some.

comment:5 Changed 9 years ago by kcrisman

Well, for some reason doing the right thing (adding to the deleted options for sparse matrices) worked this morning. Patch coming up, once I run relevant tests.

Changed 9 years ago by kcrisman

Attach after main patch

comment:6 Changed 9 years ago by kcrisman

  • Description modified (diff)
  • Status changed from needs_work to needs_review

Okay, now all is well, unless someone is *really* tricky and circumvents the decorators and explicitly removes the subdivision keyword. That would also be true for circumventing the vmin keyword, so I judge it to be a non-issue. Positive review.

Apply attachment:trac-10847-matrix_plot-subdivisions.patch and attachment:trac_10847-reviewer.patch

Note: See TracTickets for help on using tickets.