@@ -575,30 +575,32 @@ def axis(*v, **kwargs):
575575 """
576576 Set/Get the axis properties::
577577
578- axis() returns the current axis as a length a length 4 vector
578+ v = axis() returns the current axes as v = [xmin, xmax, ymin, ymax]
579579
580- axis(v) where v = [xmin, xmax, ymin, ymax] sets the min and max of the x
581- and y axis limits
580+ axis(v) where v = [xmin, xmax, ymin, ymax] sets the min and max
581+ of the x and y axes
582582
583583 axis('off') turns off the axis lines and labels
584584
585- axis('equal') changes limits of x or y axis such that equal
586- tick mark increments are equal in size. This makes a
587- circle look like a circle, for example. This is persistent.
588- For example, when axis limits are changed after this command,
589- the scale remains equal
585+ axis('equal') changes limits of x or y axis so that equal
586+ increments of x and y have the same length; a circle
587+ is circular.
590588
591- axis('scaled') makes scale equal, changes lengths of axes while
592- keeping limits of x and y axes fixed. Keeps lower left hand corner
593- in original position. Fixes axis limits.
589+ axis('scaled') achieves the same result by changing the
590+ dimensions of the plot box instead of the axis data
591+ limits.
594592
595- axis('tight') changes limits x and y axis such that all data is
593+ axis('tight') changes x and y axis limits such that all data is
596594 shown. If all data is already shown, it will move it to the center
597595 of the figure without modifying (xmax-xmin) or (ymax-ymin). Note
598- this is slightly different than in matlab. Fixes axis limits.
596+ this is slightly different than in matlab.
599597
600- axis('normal') or 'auto' sets the axis to normal, i.e.
601- turns equal scale off
598+ axis('image') is 'scaled' with the axis limits equal to the
599+ data limits.
600+
601+ axis('auto') or 'normal' (deprecated) restores default behavior;
602+ axis limits are automatically scaled to make the data fit
603+ comfortably within the plot box.
602604
603605 if len(*v)==0, you can pass in xmin, xmax, ymin, ymax as kwargs
604606 selectively to alter just those limits w/o changing the others.
@@ -612,18 +614,23 @@ def axis(*v, **kwargs):
612614 s = v [0 ].lower ()
613615 if s == 'on' : ax .set_axis_on ()
614616 elif s == 'off' : ax .set_axis_off ()
615- elif s in ('equal' , 'tight' , 'scaled' , 'normal' , 'auto' ):
617+ elif s in ('equal' , 'tight' , 'scaled' , 'normal' , 'auto' , 'image' ):
616618 ax .set_autoscale_on (True )
617619 ax .set_aspect ('auto' )
618620 ax .autoscale_view ()
619621 ax .apply_aspect ()
620622 if s == 'equal' :
621623 ax .set_aspect ('equal' , adjustable = 'datalim' )
624+ elif s == 'scaled' :
625+ ax .set_aspect ('equal' , adjustable = 'box' , anchor = 'C' )
622626 elif s == 'tight' :
623627 ax .autoscale_view (tight = True )
624628 ax .set_autoscale_on (False )
625- elif s == 'scaled' :
626- ax .set_aspect ('equal' , adjustable = 'box' )
629+ elif s == 'image' :
630+ ax .autoscale_view (tight = True )
631+ ax .set_autoscale_on (False )
632+ ax .set_aspect ('equal' , adjustable = 'box' , anchor = 'C' )
633+
627634 else :
628635 raise ValueError ('Unrecognized string %s to axis; try on or off' % s )
629636 xmin , xmax = ax .get_xlim ()
0 commit comments