Scatterplot c arg and NaN values, autonomous underwater vehicle

I've pulled my hair out for the past day trying to solve this problem and
have done extensive searches to no avail. Here's my situation:

I have data from an autonomous underwater vehicle. I have three np arrays to
plot:
1) time on the x axis
2) vehicle depth on the y axis
3) sensor reading to set the color for the scatter plot at time/depth point.

Unfortunately for me the vehicle reports sensors at different rates which
means that I might have a time and depth stamp with a 'NaN' for the sensor
value. The x/y portion of scatter deals with the NaNs with no problem, but
when I call scatter(time, depth, c=mySensorArray) and mySensorArray contains
a 'NaN' matplotlib borks. I have not been able to come up with a method
to allow the values of the sensor being plotted to set the color of the
scatter or skip the entry when the value is a 'NaN'.

What complicates the matter is that we're only gathering data on the upward
profile of the vehicle. Until recently we collected data on both up and down
legs of the Yo, so I was able to simply interpolate and fill in the NaN
values with the interpolated result and achieve gorgeous scatter plots. That
doesn't work when the data stops being gathered at the top of the Yo...
interpolating simply repeats the last value all the way back down to the
bottom when data values start getting collected again.

Thanks for any pointers... I'm really stumped.

Bob Currier

···

--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Scatterplot-c-arg-and-NaN-values-autonomous-underwater-vehicle-tp42494.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

mySensorArray = np.ma.masked_invalid(mySensorArray)

Eric

···

On 2013/11/13 11:40 AM, robertdcurrier wrote:

I've pulled my hair out for the past day trying to solve this problem and
have done extensive searches to no avail. Here's my situation:

I have data from an autonomous underwater vehicle. I have three np arrays to
plot:
1) time on the x axis
2) vehicle depth on the y axis
3) sensor reading to set the color for the scatter plot at time/depth point.

Unfortunately for me the vehicle reports sensors at different rates which
means that I might have a time and depth stamp with a 'NaN' for the sensor
value. The x/y portion of scatter deals with the NaNs with no problem, but
when I call scatter(time, depth, c=mySensorArray) and mySensorArray contains
a 'NaN' matplotlib borks. I have not been able to come up with a method
to allow the values of the sensor being plotted to set the color of the
scatter or skip the entry when the value is a 'NaN'.