I have an issue when plotting a boxplot in a subplot. My data is a time series with datetime index
which contains NaNs
. This is the code
fig, ax = plt.subplots(1,1, figsize=(5, 3))
ax.boxplot([df['col1'], df['col2']])
plt.show()
It shows and empty graph (Figue (a) below) and 'RuntimeWarning: Invalid value encountered in percentile interpolation=interpolation
.' When NaNs
are removed, the plot is showing, but I don't want to remove NaNs
before boxplotting because the result is different.
When using the following code, it returns the correct plot (Figure (b)), but not in a subplot.
df.boxplot(column=['col1', 'col2'], figsize=(5, 3))
I want something like Figure (b) in a subplot.