Open jasongrout opened 16 years ago
This seems to work in 2.9.3:
sage: m=matrix(ZZ,1,[16]); m
[16]
sage: matrix_plot(m^100).show()
sage:
I do get this warning:
sage: matrix_plot(m^1000).show()
Warning: invalid value encountered in multiply
but the image shows up (a giant black square, just like it should).
Ok, but we should still add a doctest to catch this behavior. It can be #long
, but I will reopen this for now until the doctest is added [which is standard requirement to close bugs these days :)]
Cheers,
Michael
Thanks for reopening this. The following code displays the wrong plot:
a=matrix(2,[16^1000,0,0,-16^1000]);
matrix_plot(a)
What should be displayed is the same as the plot:
a=matrix(2,[16,0,0,-16]);
matrix_plot(a)
So the matrix plot has gone from blowing up to just being wrong. Whether this is worse or better is left as an exercise for the reader.
I think this problem is a matplotlib problem and has to do with not dealing with inf or -inf in the matrix. We could send vmin and vmax parameters to the imshow command to scale the matrix manually if we see an infinity in the matrix, or we could raise an exception, or we could report the bug back up to matplotlib (if it is indeed a matplotlib issue).
this should completely deal with the dense case.
Author: William Stein
Attachment: trac_1481-part1.patch.gz
Whoever referees this patch should make sure it works well with the norm, vmin, and vmax parameters in matrix_plot
On the surface, it doesn't appear that the patch works with norm, vmin, and vmax, probably because the patch was written before we added those parameters.
Reviewer: Karl-Dieter Crisman
Does not apply to 4.7.alpha1 in any case. Needs work - though, impressively, only one hunk failed. Not bad for a patch over a year old.
The original patch doesn't seem to work at the moment (the numpy array created has dtype=object, so the integers stay as integers instead of becoming floats, so there are no infs to work around). I have a variant which works, and modified it to handle vmin and vmax, but I'm not sure what to do with norm: should the norm be applied before or after the vmin/vmax?
can I Work on this issue ???
CC: @kcrisman
Component: graphics
Author: William Stein
Reviewer: Karl-Dieter Crisman
Issue created by migration from https://trac.sagemath.org/ticket/1481