I am trying to make a bar chart with matplotlib for python. I can make a normal chart, but when I put it in logarithmic mode so that I can see the data better, the x-axis looks as if it is compressing. What is going on? Note: all data records have a minimum value of 1.
x = [t[0] for t in data]
y = [t[1] for t in data]
x_pos = np.arange(len(x))
plt.bar(x_pos, y, color='blue', log=False)
plt.xlabel(x_label)
plt.ylabel(y_label)
plt.title(title)
plt.xlim([0, len(x)])
#plt.yscale('log')
#plt.semilogy(x_pos, np.exp(-x_pos/5.0))
plt.savefig(output_path + '/' + filename)
But just by changing log=False to log=True I get:

What am I doing wrong? I just want to get a compressed view of the first graph on the y axis. As you can see, I also tried yscale('log') but I get the same result.
Thanks!
EDIT: Looks like it has something to do with the previous lines, when I remove the first line it works fine, but is unsorted:
data = sorted(data, key=lambda tup: tup[1], reverse=True)
# tuples (pair,count)
x = [t[0] for t in data]
y = [t[1] for t in data]
