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'.
mySensorArray = np.ma.masked_invalid(mySensorArray)
Eric
|