|
From: John H. <jdh...@ac...> - 2004-03-03 15:43:25
|
>>>>> "Phil" == Phil Erickson <pj...@ha...> writes:
Phil> Hi all, I am really enjoying working with matplotlib and
Phil> hats off to an excellent effort.
Phil> I have done a cursory search of the mailing list archives
Phil> but didn't find the answer to a practical question that I
Phil> ran into in MATLAB all the time (which is where I'm coming
Phil> from in terms of familiarity).
Phil> Suppose I have an array to plot, and I want to exclude
Phil> certain points from being plotted. In MATLAB, I would set
Phil> the y vector points I wanted excluded to "NaN" and then the
Phil> plot routine would draw connected lines up to the point
Phil> before the excluded one, skip the bad/not wanted point, and
Phil> then continue drawing lines beginning at the next point.
Phil> How does one accomplish that using matplotlib? This
Phil> actually comes up quite often in our radar work here, in
Phil> cases where we are making log plots of vectors which may
Phil> contain zeros.
What matplotlib currently does is simply ignore non-positive data with
an approach along the lines of
ind = nonzero(y > 0)
validy = take(y, ind)
Just to make sure I'm understanding you properly, that's not a good
solution for you because you want to the gap in the connected line
where the complex (y<=0) points are. Is this right?
What you describe is certainly possible but would impose a performance
hit that depends on the number of separate connected lines that had to
be constructed. Eg, semilogy could find the non-positive indices and
create the line segments appropriately.
As for NaN, I'm not an expert here. As far as I understand, there is
no support for it in Numeric but there is in numarray. Look for basic
numarray support in the next release.
JDH
|