i am using optimization for finding weights for portfolios of financial securities and then I try to plot those weights using horizontal bars, unfortunately, when i try to use the function ax.bar_labels the numbers are plotted above the graph itself, and either the number can’t be read as well as the y ticks can’t be read. How can I figure out this?
My code follows:
plt.figure(2)
fig, ax = plt.subplots()
ind = np.arange(0,len(data.columns))
width = 0.40
bars = ax.barh(ind, max_sharpe, width)
ax.set_yticks(ind+width/2)
ax.set_yticklabels(tickers, minor=False)
ax.bar_label(bars)
The plot i am getting is this one: