def plot_NaNs(data_dict): NaN_list = create_NaN_list(data_dict) y_axis = range(len(NaN_list)) #The respondents x_axis = range(len(NaN_list[0])) #The variables plt.figure(figsize=(20,10)) for i, y in enumerate(y_axis): ys = len(x_axis)*[y] y_vals = NaN_list[i] yscolors = ['r' if y == 0 else 'g' for y in y_vals] plt.scatter(x_axis,ys,c=yscolors,alpha=0.5, marker='s',lw=0,s=2) plt.savefig('foo.png')
def test_recode_into_binary_list(self): binary_output = create_NaN_list(self.dataDict) self.assertEqual(self.outputList, binary_output)