Box plot and missing data (NaN/Masked)

Hi,

I am trying to plot some arrays with missing data, noted as -9999.9. I have
tried setting these values to NaN and using numpy masked arrays. Neither
produces the correct plot when using box plot. Any suggestions?

e.g.

import matplotlib.pyplot as plt
import numpy as np

# works fine
y = np.array([568., 576., 436.])
plt.boxplot(y, notch=0, sym='+', vert=1, whis=1.5)
plt.show()

# same array, but with some missing data
x = np.array([-9999.9, 568., -9999.9, -9999.9, 576., -9999.9, 436.])

# mark missing data
xx = np.where(x < -9000.0, np.nan, x)

# try and plot that, nope.
plt.boxplot(xx, notch=0, sym='+', vert=1, whis=1.5)
plt.show()

# mask the array, plot that?
xxx = np.ma.array(xx, mask=np.isnan(xx))
plt.boxplot(xxx, notch=0, sym='+', vert=1, whis=1.5)
plt.show()

thanks

Martin

ยทยทยท

--
View this message in context: http://old.nabble.com/Box-plot-and-missing-data-(NaN-Masked)-tp32058883p32058883.html
Sent from the matplotlib - users mailing list archive at Nabble.com.