Check out example codes for "axes not compatible with matplotlib pdf". It will help you in understanding the concepts better.

Code Example 1

# Give bbox_inches='tight' as argument in savefig

plt.savefig('fig.png',bbox_inches='tight')

Learn ReactJs, React Native from akashmittal.com