xlim and xticks

Dear all,

I am facing a small problem with xlim and xticks and nor google nor the
api helped me (one of the reason being that I likely don't know the
exact term I am looking for).

I am plotting a barplot using pyplot and bar() on matplotlib 0.98.5.2.
If I do not use xticks the x axis goes from 0 to 500 leaving some empty
space at the right of the last bar before the frame.
When I use xticks to name my bar (name being either a string or nothing
I tried both), then the frame come beside the last bar on the right of
the plot.

Then problem is that I want to keep this space between the last bar and
the frame.
I looked at
pyplot.xlim(0,500)
pyplot.xlim(xmax = 500)
but if print pyplot.axis() returns the correct dimension the frame still
persists at this place.

How could I set the width correctly and use xticks ?

I hope I am clear in my explanations.

Pierre

Hi Pierre,

I'm not sure I understand correctly - maybe you could provide a small
stand-alone example which illustrates your problem.
For me the following works fine:

ax = axes()
ax.bar(arange(10), np.random.uniform(size=10))
xticks(0.5+arange(10), ["a\_%i" % (i) for i in arange(10)])
xlim(xmax=12)
show()

Kind regards,
Matthias

ยทยทยท

On Thursday 14 January 2010 09:42:24 Pierre-Yves wrote:

Dear all,

I am facing a small problem with xlim and xticks and nor google nor the
api helped me (one of the reason being that I likely don't know the
exact term I am looking for).

I am plotting a barplot using pyplot and bar() on matplotlib 0.98.5.2.
If I do not use xticks the x axis goes from 0 to 500 leaving some empty
space at the right of the last bar before the frame.
When I use xticks to name my bar (name being either a string or nothing
I tried both), then the frame come beside the last bar on the right of
the plot.

Then problem is that I want to keep this space between the last bar and
the frame.
I looked at
pyplot.xlim(0,500)
pyplot.xlim(xmax = 500)
but if print pyplot.axis() returns the correct dimension the frame still
persists at this place.

How could I set the width correctly and use xticks ?

I hope I am clear in my explanations.

Pierre

---------------------------------------------------------------------------
--- Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for
Conference attendees to learn about information security's most important
issues through interactions with peers, luminaries and emerging and
established companies. http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options