Here is the explanation for the code:
- x = [0, 1, 2, 3, 4, 5] is the list of product defect reason codes.
- y = [19, 12, 6, 4, 3, 2] is the list of defect counts by reason code.
- ax.bar(x, y, zs=0, zdir='y', label='Number of Defects in (X,Z)') draws the bar plot:
- The defect reason codes go on the x axis and the count of defects on the z axis.
- zdir='y' swaps the y and z axes so that y data is plotted on the z axis and z data is plotted on the y axis, which in this case are zeros.
- The label specified gets displayed in the legend.
- y = [41, 67, 80, 89, 96, 100] is the list of cumulative defects as a percentage of the total.
- ax.plot(x, y, zs=0, zdir='z', color='g', lw=5, label='Cumulative Defects in (X,Y)') draws the line plot: ...