On Mon, Jul 19, 2010 at 9:55 AM, Bala subramanian <bala.biophys...@gmail.com
> wrote:
> 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
>
Bala,
There are two issues with your current code. First, you are setting the x
limits of your plot to [1, 40], which causes the last red bar to be clipped
out. You should set it to [1, 40 + width]. Second, the set_xticks() needs
to be shifted by width. However, doing so will change the values. So, it
seems that if you change
ax.set_xticks(ind)
to
plt.xticks(ind + width, ind)
The ticks will be placed at the positions 'ind + width', but with the values
'ind'. I hope this helps.
Ben Root
------------------------------------------------------------------------------
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