Friends,

Attached a script test.py and 2 data files using with which i am trying to
make a bar plot. The output is coming nice, but the x-ticks are placed at
the left edge of the first bar. I want to make the xticks at the center
between the two bars to have a better visualization. I dnt get which
arguement i should use to get the xticks at the center of the two bars as in
the following example

http://matplotlib.sourceforge.net/examples/pylab_examples/barchart_demo.html

Thanks,
Bala
#!/usr/bin/env python   
import matplotlib.pyplot as plt
import numpy as np
from sys import argv
# user input section, input file and bound range
data1=np.loadtxt('T1.sasa',usecols=(1,))
data2=np.loadtxt('T2.sasa',usecols=(1,))

tot1=np.sum(data1); tot2=np.sum(data2)
ind=np.arange(1,len(data1)+1)
width=0.5
new1=(data1/tot1)*100
new2=(data1/tot2)*100

# figure creation
fig = plt.figure()
ax = fig.add_subplot(111)
ax.set_title('SASA')
R1=ax.bar(ind,new1,width,color='black')
R2=ax.bar(ind+width,new2,width,color='red')

ax.set_xlim([1,40])
ax.set_xticks(ind)


plt.show()




Attachment: T1.sasa
Description: Binary data

Attachment: T2.sasa
Description: Binary data

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to