Re: How not to plot blank/zero points? [message #67540] |
Sun, 02 August 2009 12:47 |
Adam Solomon
Messages: 11 Registered: July 2009
|
Junior Member |
|
|
On Aug 1, 10:17 pm, pp <pp.pente...@gmail.com> wrote:
> On Aug 2, 12:50 am, Adam Solomon <rampa...@gmail.com> wrote:
>
>> I have an array (matrix, about 13 columns) of strings consisting of
>> numbers and blanks*. When I plot the data in each column, the blanks
>> get plotted as zeroes, so if I just plot points, things are OK (as
>> long as I start my plot range above 0), but if I want to connect the
>> points with lines then there are lines going to and from these blank
>> points.
>
>> How do I make IDL not plot these blank points (or points equal to 0)?
>> The only way I've found is by plotting in log (so the points don't
>> even show up) but for various reasons I'd rather not use log.
>
>> *If I were to do this as a floating point array, the blanks all become
>> 0.000, and that doesn't help.
>
> Saying your array is called data, here are 3 ways to do it:
>
> 1) Filter out the blanks, using where() to find the points you want,
> as in:
> iplot,data[where(data ne 0.0)]
> assuming the blanks are 0.0. If they are empty strings, as your
> descritpion suggests:
> iplot,data[where(data ne '')]
> or use whatever value the blanks happen to have in the argument of
> where()
>
> 2) If you want to plot only values in a certain range, use the
> min_value and/or max_value keywords:
> iplot,data,min_value=minv
> with minv of a proper value, higher than 0., and lower than the
> minimum you want to plot
>
> 3) Mark the points you do not want to plot with NaN, as in:
> data[where(data eq 0.0)]=!values.f_nan
> iplot,data
> Everything with a value of NaN is ignored by iplot.
Excellent!! I didn't try #1, but both #2 and #3 worked brilliantly.
Thanks.
|
|
|
Re: How not to plot blank/zero points? [message #67542 is a reply to message #67540] |
Sat, 01 August 2009 22:25  |
Adam Solomon
Messages: 11 Registered: July 2009
|
Junior Member |
|
|
On Aug 1, 10:17 pm, pp <pp.pente...@gmail.com> wrote:
> On Aug 2, 12:50 am, Adam Solomon <rampa...@gmail.com> wrote:
>
>> I have an array (matrix, about 13 columns) of strings consisting of
>> numbers and blanks*. When I plot the data in each column, the blanks
>> get plotted as zeroes, so if I just plot points, things are OK (as
>> long as I start my plot range above 0), but if I want to connect the
>> points with lines then there are lines going to and from these blank
>> points.
>
>> How do I make IDL not plot these blank points (or points equal to 0)?
>> The only way I've found is by plotting in log (so the points don't
>> even show up) but for various reasons I'd rather not use log.
>
>> *If I were to do this as a floating point array, the blanks all become
>> 0.000, and that doesn't help.
>
> Saying your array is called data, here are 3 ways to do it:
>
> 1) Filter out the blanks, using where() to find the points you want,
> as in:
> iplot,data[where(data ne 0.0)]
> assuming the blanks are 0.0. If they are empty strings, as your
> descritpion suggests:
> iplot,data[where(data ne '')]
> or use whatever value the blanks happen to have in the argument of
> where()
>
> 2) If you want to plot only values in a certain range, use the
> min_value and/or max_value keywords:
> iplot,data,min_value=minv
> with minv of a proper value, higher than 0., and lower than the
> minimum you want to plot
>
> 3) Mark the points you do not want to plot with NaN, as in:
> data[where(data eq 0.0)]=!values.f_nan
> iplot,data
> Everything with a value of NaN is ignored by iplot.
Thanks!! I use plot (I'm not sure what iplot is) - will these work
with plot as well? Unable to try at the moment.
|
|
|
Re: How not to plot blank/zero points? [message #67543 is a reply to message #67542] |
Sat, 01 August 2009 22:17  |
penteado
Messages: 866 Registered: February 2018
|
Senior Member Administrator |
|
|
On Aug 2, 12:50 am, Adam Solomon <rampa...@gmail.com> wrote:
> I have an array (matrix, about 13 columns) of strings consisting of
> numbers and blanks*. When I plot the data in each column, the blanks
> get plotted as zeroes, so if I just plot points, things are OK (as
> long as I start my plot range above 0), but if I want to connect the
> points with lines then there are lines going to and from these blank
> points.
>
> How do I make IDL not plot these blank points (or points equal to 0)?
> The only way I've found is by plotting in log (so the points don't
> even show up) but for various reasons I'd rather not use log.
>
> *If I were to do this as a floating point array, the blanks all become
> 0.000, and that doesn't help.
Saying your array is called data, here are 3 ways to do it:
1) Filter out the blanks, using where() to find the points you want,
as in:
iplot,data[where(data ne 0.0)]
assuming the blanks are 0.0. If they are empty strings, as your
descritpion suggests:
iplot,data[where(data ne '')]
or use whatever value the blanks happen to have in the argument of
where()
2) If you want to plot only values in a certain range, use the
min_value and/or max_value keywords:
iplot,data,min_value=minv
with minv of a proper value, higher than 0., and lower than the
minimum you want to plot
3) Mark the points you do not want to plot with NaN, as in:
data[where(data eq 0.0)]=!values.f_nan
iplot,data
Everything with a value of NaN is ignored by iplot.
|
|
|