Home > OS >  Difference between 'data' and 'axes fraction' in matplotlib?
Difference between 'data' and 'axes fraction' in matplotlib?

Time:10-02

What does xycoords=('data','axes fraction') mean? I have read

demo of data and frac coords

import matplotlib.pyplot as plt

plt.plot([0, 10], [0, 5])

# at x=2, y=1
plt.annotate('data @ (2, 1)', xy=(2, 1), xycoords='data')

# at 200% x, 100% y
plt.annotate('frac @ (2, 1)', xy=(2, 1), xycoords='axes fraction')

# at x=2, 100% y
plt.annotate('(data, frac) @ (2, 1)', xy=(2, 1), xycoords=('data', 'axes fraction'))

# at 200% x, y=1
plt.annotate('(frac, data) @ (2, 1)', xy=(2, 1), xycoords=('axes fraction', 'data'))
  • Related