I'm trying to make a type of box plot by using this code
import numpy as np
import matplotlib.pyplot as plt
N = 3
ind = np.arange(N) # the x locations for the groups
width = 2 # the height of the bars: can also be len(x) sequence
height = 0.35 # height of bars
D_data = np.array([27.68,np.nan,np.nan])
E_data = np.array([np.nan,18.59,18.31])
fig, ax = plt.subplots()
E = ax.bar(ind, width, height, bottom=E_data-1, label='E')
D = ax.bar(ind, width, height, bottom=D_data-1, label='D')
plt.show()
The graph only outputs the D variable and not the E variable, and I've figured out it's because the first value is np.nan. If I change the first value of E_data to 1, then it works. Is there a way around this?? Is this a problem with the package? Is there a better way to do nan in matplotlib than with numpy? Otherwise it works fine.