output = Path("error-bar-add.png") fig.savefig(output, dpi=160) plt.close(fig) pixels = mpimg.imread(output) symmetric_directions = len(symmetric.lines[2]) asymmetric_directions = len(asymmetric.lines[2]) if symmetric_directions != 1: raise RuntimeError("symmetric error bars were not created") if asymmetric_directions != 2: raise RuntimeError("horizontal and vertical error bars were not created") print(f"symmetric error directions: {symmetric_directions}") print(f"asymmetric error directions: {asymmetric_directions}") print(f"image shape: {pixels.shape[0]} x {pixels.shape[1]} x {pixels.shape[2]}") print(f"saved: {output}")