very simple question, aspect ratio

Hi all,
i just want to have a simple 2-bar histogram,
and my problem is that i want my axis to be with NON-squared aspect,
i.e. the y-axes automatically scaled (and this yet works this way),but
the x-axis to be as long as it need to display 2 little bars.
Instead i get a squared graph with 2 big bars.
I also tried using something like "plt.axis([0,1,0,mymax*1.2])",
changing the second value, but this affects the scale and NOT my
picture aspect ratio.

This is my simploe source:

import numpy as np
import matplotlib
import matplotlib.pyplot as plt

N = 1
ind = np.arange(N)
width = 0.05

rects2 = plt.bar(ind+width, 100, width, color='g')
rects1 = plt.bar(ind, 200, width, color='b')

I tried many things, figsize, axis.. i have no idea,
probably because i'm new to matplotlib programming

Thank you very much for any help,
my best

Dante Plicato wrote:

Hi all,
i just want to have a simple 2-bar histogram,
and my problem is that i want my axis to be with NON-squared aspect,
i.e. the y-axes automatically scaled (and this yet works this way),but
the x-axis to be as long as it need to display 2 little bars.
Instead i get a squared graph with 2 big bars.
I also tried using something like "plt.axis([0,1,0,mymax*1.2])",
changing the second value, but this affects the scale and NOT my
picture aspect ratio.

I'm sorry; I haven't been able to figure out what you want the plot to look like, and I suspect others on the list may be having the same problem.

When you describe the bars as "big" or "little", are you referring to width? Height? spacing?

When I run your script, I don't see anything that I would describe as "squared aspect". What physical dimensions would you like the axes to have, and what physical dimensions would you like the bars to have?

Maybe you can make a sketch using characters to show what you
want the plot to look like, e.g.,

···

___________________

                >
  ____ |
  > > ____ |
  > > > > >

-------------------

Also, is there a reason you are using two calls to "bar" instead of one? Note that arguments such as color can be sequences.

Eric

This is my simploe source:

import numpy as np
import matplotlib
import matplotlib.pyplot as plt

N = 1
ind = np.arange(N)
width = 0.05

rects2 = plt.bar(ind+width, 100, width, color='g')
rects1 = plt.bar(ind, 200, width, color='b')

I tried many things, figsize, axis.. i have no idea,
probably because i'm new to matplotlib programming

Thank you very much for any help,
my best

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

Hi Eric,
first of all thank you for your reply.
My problem is so simple that it is diffucult to explain :slight_smile:
may be pictures speak better than me.
Let me show you 2 simple pictures and you'll understand:

this is what i want to do: (done with excel)
http://89.96.100.40/~dante/wish.png
(2 simple bars centered in a short enough x axis)

and this is what i have with matplotlib:
http://89.96.100.40/~dante/hist.png

Thank you again for your time,
dp

2009/2/23 Eric Firing <efiring@...202...>:

···

Dante Plicato wrote:

Hi all,
i just want to have a simple 2-bar histogram,
and my problem is that i want my axis to be with NON-squared aspect,
i.e. the y-axes automatically scaled (and this yet works this way),but
the x-axis to be as long as it need to display 2 little bars.
Instead i get a squared graph with 2 big bars.
I also tried using something like "plt.axis([0,1,0,mymax*1.2])",
changing the second value, but this affects the scale and NOT my
picture aspect ratio.

I'm sorry; I haven't been able to figure out what you want the plot to look
like, and I suspect others on the list may be having the same problem.

When you describe the bars as "big" or "little", are you referring to width?
Height? spacing?

When I run your script, I don't see anything that I would describe as
"squared aspect". What physical dimensions would you like the axes to have,
and what physical dimensions would you like the bars to have?

Maybe you can make a sketch using characters to show what you
want the plot to look like, e.g.,

___________________
> >
> ____ |
> > > ____ |
> > > > > >
-------------------

Also, is there a reason you are using two calls to "bar" instead of one?
Note that arguments such as color can be sequences.

Eric

This is my simploe source:

import numpy as np
import matplotlib
import matplotlib.pyplot as plt

N = 1
ind = np.arange(N)
width = 0.05

rects2 = plt.bar(ind+width, 100, width, color='g')
rects1 = plt.bar(ind, 200, width, color='b')

I tried many things, figsize, axis.. i have no idea,
probably because i'm new to matplotlib programming

Thank you very much for any help,
my best

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco,
CA
-OSBC tackles the biggest issue in open source: Open Sourcing the
Enterprise
-Strategies to boost innovation and cut costs with open source
participation
-Receive a $600 discount off the registration fee with the source code:
SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

Dante Plicato wrote:

Hi Eric,
first of all thank you for your reply.
My problem is so simple that it is diffucult to explain :slight_smile:
may be pictures speak better than me.
Let me show you 2 simple pictures and you'll understand:

this is what i want to do: (done with excel)
http://89.96.100.40/~dante/wish.png
(2 simple bars centered in a short enough x axis)

and this is what i have with matplotlib:
http://89.96.100.40/~dante/hist.png

That's very helpful. Using mpl from svn, I get quite a different result, and much closer to what you want. What version of mpl are you using? Can you update to the latest release, or to svn? I think that if you do that, and use the bar examples included with mpl, you will be able to get the desired result.

Eric

···

Thank you again for your time,
dp

2009/2/23 Eric Firing <efiring@...202...>:

Dante Plicato wrote:

Hi all,
i just want to have a simple 2-bar histogram,
and my problem is that i want my axis to be with NON-squared aspect,
i.e. the y-axes automatically scaled (and this yet works this way),but
the x-axis to be as long as it need to display 2 little bars.
Instead i get a squared graph with 2 big bars.
I also tried using something like "plt.axis([0,1,0,mymax*1.2])",
changing the second value, but this affects the scale and NOT my
picture aspect ratio.

I'm sorry; I haven't been able to figure out what you want the plot to look
like, and I suspect others on the list may be having the same problem.

When you describe the bars as "big" or "little", are you referring to width?
Height? spacing?

When I run your script, I don't see anything that I would describe as
"squared aspect". What physical dimensions would you like the axes to have,
and what physical dimensions would you like the bars to have?

Maybe you can make a sketch using characters to show what you
want the plot to look like, e.g.,

___________________
> >
> ____ |
> > > ____ |
> > > > > >
-------------------

Also, is there a reason you are using two calls to "bar" instead of one?
Note that arguments such as color can be sequences.

Eric

This is my simploe source:

import numpy as np
import matplotlib
import matplotlib.pyplot as plt

N = 1
ind = np.arange(N)
width = 0.05

rects2 = plt.bar(ind+width, 100, width, color='g')
rects1 = plt.bar(ind, 200, width, color='b')

I tried many things, figsize, axis.. i have no idea,
probably because i'm new to matplotlib programming

Thank you very much for any help,
my best