I noticed today that when I create a bar graph with zero values that the
labels don't align correctly:
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
names = ['name a', 'name b', 'name c', 'named', 'name e', 'name f']
defects = [0, 0, 0, 5, 6, 7]
ax = fig.add_subplot(111)
widths=.75
ind = np.arange(len(defects)) # the x locations for the groups
ind = ind + widths
bar = ax.bar(ind, defects, width=widths)
plt.xticks(ind + widths/2.0 , names, rotation=90)
ax.set_xlabel('Sorter')
ax.set_ylabel('Percentage (Average)')
plt.subplots_adjust( bottom=0.30)
ax.yaxis.grid(True, linestyle='-', which='major', color='lightgrey',
alpha=0.5)
ax.set_axisbelow(True)
plt.savefig('temp.png')
defects = [1, 2, 3, 5, 6, 7]
# same code...
When run with the defects with non zero values, the labels appear as I
expect; with zero values, the left label aligns incorrectly with the y axis.
Thanks
P.
------------------------------------------------------------------------------
How fast is your code?
3 out of 4 devs don\\\'t know how their code performs in production.
Find out how slow your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219672;13503038;z?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users