I am referencing this post and implementing the solution, however I am getting very large values. Thanks for any help, attached it the code.
import numpy as np
import matplotlib.pyplot as plt
x_labels = ['x1','x2','x3']
y_values = [30,40,50]
coordList = []
x_vals = []
i = 0
fig, ax = plt.subplots()
for item in x_labels:
x_vals.append(i)
i+=1
points, = ax.plot(x_vals, y_values)
x, y = points.get_data()
print(x, y)
xy_pixels = ax.transData.transform(np.vstack([x,y]).T)
xpix, ypix = xy_pixels.T
for xp, yp in zip(xpix, ypix):
coordList.append(f'{xp}, {yp}')
print(coordList)
Here is a resulting coordList:
['80.0, 39969.6', '576.0, 37382.4', '1072.0, 34425.6', '1568.0, 31838.399999999998', '2064.0, 29620.799999999996', '2560.0, 26663.999999999996', '3056.0, 24815.999999999996', '3552.0, 21859.199999999997', '4048.0, 19271.999999999996']