Tony S Yu wrote:
> On Sep 26, 2008, at 2:28 PM, John Hunter wrote:
>
>> On Fri, Sep 26, 2008 at 12:39 PM, Tony S Yu <[EMAIL PROTECTED]> wrote:
>>
>>> + if all(nonzero == False):
>>> + raise ValueError('spy cannot plot sparse zeros
>>> matrix')
>> Is raising an exception the right choice here -- why can't we plot an
>> all zeros image?
>>
>> JDH
>
> I guess you could plot sparse all-zero matrices with image mode. My
> only hesitation is that sparse arrays tend to be very large and (I
> imagine) this would lead to very slow performance. I assumed this was
> the reason image mode wasn't adapted to use sparse arrays.
Also, if an image cannot be resolved by the output device, info is
lost--one might not see anything at a location where there actually is a
value--whereas with markers, a marker will always show up, and the only
problem is that one can't necessarily distinguish a single point from a
cluster.
The real problem with all-zero values is that plot can't handle
"plot([],[])". One can work around this by putting in bogus values to
plot a single point, saving the line, and then setting the line data to
empty; or, better, by not using the high-level plot command, but by
generating the Line2D object and adding it to the axes. The Line2D
initializer is happy with empty x and y sequences. I think if you use
this approach it will kill two bugs (failure on all-zeros with sparse
and full arrays) with one very simple stone.
Eric
>
> Actually, now that I think about it: you could plot a trivially small
> image and just adjust the coordinates so that they correspond to the
> original matrix shape. Is this what you were thinking?
>
> I should note that a dense zero array also fails to plot with spy *if
> marker mode is used*.
>
> -T
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Matplotlib-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel