the issue with the following is that in a small sample, whatever label I used, matplotlib plotted in the order of x/y arrays I gave. It just doesnt apply when the dataset increase.
data = {a:1, b:2, c:3}
def plot_bar_new(data, reverse):
data = sorted(data.items(), key=lambda x:x[1], reverse=reverse)
plotx, ploty = zip(*data) # replaces the for-loop from plot_bar()
locs = range(0, len(ploty))
plt.figure()
plt.bar(locs, ploty)
plt.xticks(locs, plotx)
plt.show()
plot_bar_new({1: 1, 2: 2, 3: 3}, False)
- I wish to understand why matplotlib doesnt plot the data in the order the user give
- I wish to plot the data I stream by the descending order of values,
- and the keys printed as is on the x label
- But the data is huge and I can only have every 300th x label visible.



