automatically adjust x, y axis equal limit on a 1:1 ratio plot?

Dear all,

I am making a 1:1 ratio plot to compare data.
I can write a small part of code to detect which range of the x or y axis is bigger and then adjust the axis of shorter range to have the same range with the longer one.
and use set_aspect(‘equal’) method to have the same tick interval on both axises.
but is there an automatic method to do this job?

Thanks,

Chao

···


Chao YUE
Laboratoire des Sciences du Climat et de l’Environnement (LSCE-IPSL)
UMR 1572 CEA-CNRS-UVSQ
Batiment 712 - Pe 119
91191 GIF Sur YVETTE Cedex

Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16


two lines:

ax.set_xlim(min(ax.get_xlim()+ax.get_ylim()),max(ax.get_xlim()+ax.get_ylim()))
ax.set_ylim(ax.get_xlim())

chao

2011/10/18 Chao YUE <chaoyuejoy@…287…>

···

Dear all,

I am making a 1:1 ratio plot to compare data.
I can write a small part of code to detect which range of the x or y axis is bigger and then adjust the axis of shorter range to have the same range with the longer one.

and use set_aspect(‘equal’) method to have the same tick interval on both axises.
but is there an automatic method to do this job?

Thanks,

Chao


Chao YUE
Laboratoire des Sciences du Climat et de l’Environnement (LSCE-IPSL)
UMR 1572 CEA-CNRS-UVSQ
Batiment 712 - Pe 119
91191 GIF Sur YVETTE Cedex

Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16



Chao YUE
Laboratoire des Sciences du Climat et de l’Environnement (LSCE-IPSL)
UMR 1572 CEA-CNRS-UVSQ
Batiment 712 - Pe 119
91191 GIF Sur YVETTE Cedex

Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16