pwtools.mpl.new_axis

pwtools.mpl.new_axis(fig, hostax, off=50, loc='bottom', ticks=None, wsadd=0.1, label='', sharex=False, sharey=False)[source]

Make a new axis line using mpl_toolkits.axes_grid’s SubplotHost and ParasiteAxes. The new axis line will be an instance of ParasiteAxes attached to hostax. You can do twinx()/twiny() type axis (off=0) or completely free-standing axis lines (off > 0).

Parameters:
  • fig (mpl Figure)

  • hostax (Instance of matplotlib.axes.HostAxesSubplot. This is the subplot) – of the figure fig w.r.t which all new axis lines are placed. See make_axes_grid_fig().

  • off (offset in points, used with parax.get_grid_helper().new_fixed_axis)

  • loc (one of 'left', 'right', 'top', 'bottom', where to place the new axis) – line

  • ticks (sequence of ticks (numbers))

  • wsadd (Whitespace to add at the location loc to make space for the new) – axis line (only useful if off > 0). The number is a relative unit and is used to change the bounding box: hostax.get_position().

  • label (str, xlabel (ylabel) for 'top','bottom' ('left', 'right'))

  • sharex (bool, share xaxis (yaxis) with hostax)

  • sharey (bool, share xaxis (yaxis) with hostax)

Returns:

  • (fig, hostax, parax)

  • fig (the Figure)

  • hostax (the hostax)

  • parax (the new ParasiteAxes instance)

Notes

  • The sharex/sharey thing may not work correctly.