@@ -68,7 +68,7 @@ def __init__(self, data, affine=None, axes=None, cmap='gray',
6868 self ._affine = affine .copy ()
6969 codes = axcodes2ornt (aff2axcodes (self ._affine ))
7070 order = np .argsort ([c [0 ] for c in codes ])
71- flips = np .array ([c [1 ] for c in codes ])[order ]
71+ flips = np .array ([c [1 ] < 0 for c in codes ])[order ]
7272 self ._order = dict (x = int (order [0 ]), y = int (order [1 ]), z = int (order [2 ]))
7373 self ._flips = dict (x = flips [0 ], y = flips [1 ], z = flips [2 ])
7474 self ._scalers = np .abs (self ._affine ).max (axis = 0 )[:3 ]
@@ -128,7 +128,10 @@ def __init__(self, data, affine=None, axes=None, cmap='gray',
128128
129129 # set up axis crosshairs
130130 self ._crosshairs = dict ()
131- for type_ , i_1 , i_2 in zip ('xyz' , 'yxx' , 'zzy' ):
131+ r = [self ._scalers [self ._order ['z' ]] / self ._scalers [self ._order ['y' ]],
132+ self ._scalers [self ._order ['z' ]] / self ._scalers [self ._order ['x' ]],
133+ self ._scalers [self ._order ['y' ]] / self ._scalers [self ._order ['x' ]]]
134+ for type_ , i_1 , i_2 , ratio in zip ('xyz' , 'yxx' , 'zzy' , r ):
132135 ax , label = self ._axes [type_ ], labels [type_ ]
133136 vert = ax .plot ([self ._idx [i_1 ]] * 2 ,
134137 [- 0.5 , self ._sizes [i_2 ] - 0.5 ],
@@ -151,7 +154,7 @@ def __init__(self, data, affine=None, axes=None, cmap='gray',
151154 horizontalalignment = anchor [0 ],
152155 verticalalignment = anchor [1 ])
153156 ax .axis (lims )
154- # ax.set_aspect(aspect_ratio[type_]) # XXX FIX
157+ ax .set_aspect (ratio )
155158 ax .patch .set_visible (False )
156159 ax .set_frame_on (False )
157160 ax .axes .get_yaxis ().set_visible (False )
0 commit comments