Pixel shape

Hi at all,
I have a numpy matrix (an image) and I'd like to show it.
I thought to use show function, but I have a question.
I don't want that the pixel have dimension 1x1 unit but I want for example 1X1.5 unit (I don't want a square but a rectangle).
How can I do this?
Thanks in advance.
Paolo

Hello,

check the help ;). you can set aspect='auto' or something fixed.

Regards,

Sebastian

···

On Sat, 2011-04-16 at 10:43 +0200, Paolo Zaffino wrote:

Hi at all,
I have a numpy matrix (an image) and I'd like to show it.
I thought to use show function, but I have a question.
I don't want that the pixel have dimension 1x1 unit but I want for
example 1X1.5 unit (I don't want a square but a rectangle).
How can I do this?
Thanks in advance.
Paolo

------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve
application availability and disaster protection. Learn more about boosting
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Thanks for the reply.
I checked in the help...I didn't understand what I must to use.
Should you post me the link of the guide of this setting?
Thanks!

···

Il 16/04/2011 10:47, Sebastian Berg ha scritto:

Hello,

check the help ;). you can set aspect='auto' or something fixed.

Regards,

Sebastian

On Sat, 2011-04-16 at 10:43 +0200, Paolo Zaffino wrote:

Hi at all,
I have a numpy matrix (an image) and I'd like to show it.
I thought to use show function, but I have a question.
I don't want that the pixel have dimension 1x1 unit but I want for
example 1X1.5 unit (I don't want a square but a rectangle).
How can I do this?
Thanks in advance.
Paolo

------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve
application availability and disaster protection. Learn more about boosting
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve
application availability and disaster protection. Learn more about boosting
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

The solution is already the aspect='auto', ie:

import numpy as np
from matplotlib import pyplot as plt
a = np.arange(100).reshape(10,10)
plt.imshow(a, aspect='auto')

aspect='auto' is what you were looking for, the documentation (as you
probably already found is for example at:
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.imshow
or in interactive help.

···

On Sun, 2011-04-17 at 23:16 +0200, Paolo Zaffino wrote:

Thanks for the reply.
I checked in the help...I didn't understand what I must to use.
Should you post me the link of the guide of this setting?
Thanks!

Il 16/04/2011 10:47, Sebastian Berg ha scritto:
> Hello,
>
> check the help ;). you can set aspect='auto' or something fixed.
>
> Regards,
>
> Sebastian
>
> On Sat, 2011-04-16 at 10:43 +0200, Paolo Zaffino wrote:
>> Hi at all,
>> I have a numpy matrix (an image) and I'd like to show it.
>> I thought to use show function, but I have a question.
>> I don't want that the pixel have dimension 1x1 unit but I want for
>> example 1X1.5 unit (I don't want a square but a rectangle).
>> How can I do this?
>> Thanks in advance.
>> Paolo
>>
>> ------------------------------------------------------------------------------
>> Benefiting from Server Virtualization: Beyond Initial Workload
>> Consolidation -- Increasing the use of server virtualization is a top
>> priority.Virtualization can reduce costs, simplify management, and improve
>> application availability and disaster protection. Learn more about boosting
>> the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
>> _______________________________________________
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
>
> ------------------------------------------------------------------------------
> Benefiting from Server Virtualization: Beyond Initial Workload
> Consolidation -- Increasing the use of server virtualization is a top
> priority.Virtualization can reduce costs, simplify management, and improve
> application availability and disaster protection. Learn more about boosting
> the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve
application availability and disaster protection. Learn more about boosting
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Actually, I think he’s wanting a set aspect, right? Either way, it’s just “aspect=1.5” or “aspect=0.6667” depending on the orientation he wants.

···

On Mon, Apr 18, 2011 at 6:37 AM, Sebastian Berg <sebastian@…3476…> wrote:

The solution is already the aspect=‘auto’, ie:

import numpy as np

from matplotlib import pyplot as plt

a = np.arange(100).reshape(10,10)

plt.imshow(a, aspect=‘auto’)

aspect=‘auto’ is what you were looking for, the documentation (as you

probably already found is for example at:

http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.imshow

or in interactive help.

On Sun, 2011-04-17 at 23:16 +0200, Paolo Zaffino wrote:

Thanks for the reply.

I checked in the help…I didn’t understand what I must to use.

Should you post me the link of the guide of this setting?

Thanks!

Il 16/04/2011 10:47, Sebastian Berg ha scritto:

Hello,

check the help ;). you can set aspect=‘auto’ or something fixed.

Regards,

Sebastian

On Sat, 2011-04-16 at 10:43 +0200, Paolo Zaffino wrote:

Hi at all,

I have a numpy matrix (an image) and I’d like to show it.

I thought to use show function, but I have a question.

I don’t want that the pixel have dimension 1x1 unit but I want for

example 1X1.5 unit (I don’t want a square but a rectangle).

How can I do this?

Thanks in advance.

Paolo


Benefiting from Server Virtualization: Beyond Initial Workload

Consolidation – Increasing the use of server virtualization is a top

priority.Virtualization can reduce costs, simplify management, and improve

application availability and disaster protection. Learn more about boosting

the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Benefiting from Server Virtualization: Beyond Initial Workload

Consolidation – Increasing the use of server virtualization is a top

priority.Virtualization can reduce costs, simplify management, and improve

application availability and disaster protection. Learn more about boosting

the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Benefiting from Server Virtualization: Beyond Initial Workload

Consolidation – Increasing the use of server virtualization is a top

priority.Virtualization can reduce costs, simplify management, and improve

application availability and disaster protection. Learn more about boosting

the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Benefiting from Server Virtualization: Beyond Initial Workload

Consolidation – Increasing the use of server virtualization is a top

priority.Virtualization can reduce costs, simplify management, and improve

application availability and disaster protection. Learn more about boosting

the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

I have resolved using the aspect setting.
I calculated the ratio between the two pixel dimensions and I use
this value for aspect (if you want to shift the pixel size you can
use the inverse of this value).
Thank you for the support!
Paolo

···

http://p.sf.net/sfu/vmware-sfdev2dev


Matplotlib-users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/matplotlib-users