Best way to graph a discontinuous data set?

gseaborn
Posts: 16
Joined: 2008-08-01
Location: Canada

I have a numeric data set that is interspersed with "-1" values. Wherever there is a "-1", I would like the graph not to plot the point, and to make a gap between the two adjacent points (not join them up).

Is there any easy way to do this? I know I can use DeletePoints to remove the points that have a value of "-1", but I'm not sure how I can make it so that the line graph is plotted discontinuously.

Thanks


aclight
Posts: 241
Joined: 2007-03-01
Location: United States

Igor plots a gap where the value of a wave is NaN (not a number), so you just need to replace all -1 values in your wave with NaN and then display the wave.

Something like:
foo = foo[p] == -1 ? NaN : foo[p]
should work for the replacement.


gseaborn
Posts: 16
Joined: 2008-08-01
Location: Canada

Thanks - that's perfect.


patarroyo
Posts: 21
Joined: 2008-07-08
Location: United States

aclight, where can I learn more about the syntax that you used? That functionality looks interesting, but I don't follow it.


andyfaff
Posts: 56
Joined: 2007-09-12
Location: Australia

It's in the IGOR help browser. Look for ?: in the index.

On the LHS you have a "True or false" question.
Part 1:
foo[p]==-1? which points in foo are equal to -1?

Part 2:
foo= ....... NaN : foo[p]

where the question in part 1 equates to True, set the value of foo to NaN. Where the question equates to False, leave the point as it is.

aclight wrote:
Igor plots a gap where the value of a wave is NaN (not a number), so you just need to replace all -1 values in your wave with NaN and then display the wave.

Something like:
foo = foo[p] == -1 ? NaN : foo[p]
should work for the replacement.


Back to top