|
From: vineeth <vin...@gm...> - 2013-03-04 01:38:45
|
Hello,
I have attached the histogram that I generated. When specifying large
numbers like 1000 or more, the xticks tend to overlap and it gives a
clumsy impression. Is there a way to avoid this?. What can be done to
give gaps between the ticks?. Say in my case just show 3 to 4 ticks in x
axis rather than specifying all the ticks. The following is my code:
def plotHistogram(veh_no, value, vehicle_no, fig_no):
font = {'family' : 'serif',
'weight' : 'normal',
'size' : 10}
rc('font', **font)
count = 1
legends = []
print veh_no
plt.figure(num=fig_no,dpi=105)
for i in range(len(value)):
ax = plt.subplot(2,2,i+1)
n, bins, patches = plt.hist(value[i],100,label=veh_no[i])
plt.ylabel('frequency',position=(0.5,0.5))
plt.xlabel('x valuels')
plt.grid()
min_val = int(round(min(value[i]),0))
max_val = int(round(max(value[i]),0))
ax.set_xlim(min_val-2,max_val+2)
locs,labels = plt.xticks()
plt.xticks(locs, map(lambda x: "%g" % x, locs))
plt.savefig('figurename.eps',dpi=70)
count += 1
Thank You
Vineeth
|