original_docstring: shift axis ax by ydiff, maintaining point v at the same location
docstring: shift axis ax by ydiff, maintaining point v at the same location
docstring_tokens: shift axis ax by ydiff maintaining point v at the same location
code: def adjust_yaxis(ax,ydif,v):
      """shift axis ax by ydiff, maintaining point v at the same location"""
      inv = ax.transData.inverted()
      _, dy = inv.transform((0, 0)) - inv.transform((0, ydif))
      miny, maxy = ax.get_ylim()
      miny, maxy = miny - v, maxy - v
      if -miny>maxy or (-miny==maxy and dy > 0):
          nminy = miny
          nmaxy = miny*(maxy+dy)/(miny+dy)
      else:
          nmaxy = maxy
          nminy = maxy*(miny+dy)/(maxy+dy)
      ax.set_ylim(nminy+v, nmaxy+v)
code_tokens: def adjust_yaxis ( ax , ydif , v ) : inv = ax . transData . inverted ( ) _ , dy = inv . transform ( ( 0 , 0 ) ) - inv . transform ( ( 0 , ydif ) ) miny , maxy = ax . get_ylim ( ) miny , maxy = miny - v , maxy - v if - miny > maxy or ( - miny == maxy and dy > 0 ) : nminy = miny nmaxy = miny * ( maxy + dy ) / ( miny + dy ) else : nmaxy = maxy nminy = maxy * ( miny + dy ) / ( maxy + dy ) ax . set_ylim ( nminy + v , nmaxy + v )
short_docstring: shift axis ax by ydiff, maintaining point v at the same location
short_docstring_tokens: shift axis ax by ydiff maintaining point v at the same location
comment: """shift axis ax by ydiff, maintaining point v at the same location"""