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-%28NaN-Masked%29-tp32058883p32058883.html Sent from the matplotlib - users mailing list archive at Nabble.com. ------------------------------------------------------------------------------ AppSumo Presents a FREE Video for the SourceForge Community by Eric Ries, the creator of the Lean Startup Methodology on "Lean Startup Secrets Revealed." This video shows you how to validate your ideas, optimize your ideas and identify your business strategy. http://p.sf.net/sfu/appsumosfdev2dev _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users