How does one retrieve data programmatically from a matplotlib bar chart? I can do it for a matplotlib line chart as follows, so maybe I'm fairly close:
import matplotlib.pyplot as plt
plt.plot([1,2,3],[4,5,6])
axis = plt.gca()
line = axis.lines[0]
x_plot, y_plot = line.get_xydata().T
print("x_plot: ", x_plot)
print("y_plot: ", y_plot)
for a bar chart, however, there are no lines, and I'm unclear what the equivalent object is:
plt.bar([1,2,3], [4,5,6])
axis = plt.gca()
???
FWIW, here are a couple of related postings (that don't go into bar charts):