Alen Ribic wrote:
> How do I set my vertical bar to be fixed width?

By default, bars are created with a fixed width of 0.8, which can be
changed with the width keyword arg like so:

bar(range(2), range(1,3), width = 0.5)


> Depending on amount of data on my x axis, the bars get created
> accordingly and the width gets adjusted to fit into the graph.
The width in pixels/proportion of axis is dependent on the range of the
x-axis, which you can set manually too.

There's probably a more elegant way of doing this, but here's a quick 
and dirty method for interactive mode (ipython/pylab):

# Make a figure, catch the reference as f
f = figure(1)

# Draw some bars
bar_list = bar(array([0,0.5,1.0]), array([1.0,2.0,3.0]), width = 0.25)

# Get the subplot (f.axes is a list containing the subplots)
s = f.axes[0]

# Set the x-axis limits of the subplot
s.set_xlim((-5.0, 5.0))

# Redraw
draw()


Fred

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to