irfpy.util.plttools

In house matplotlib tools.

irfpy.util.plttools.subplot_coords(nraw, ncol, iaxis, fig=None)[source]

Return the coordinate of the subplot.

Parameters:
  • nraw – The number of raw

  • ncol – The number of column

  • iaxis – The index of the axis. From 1 to raw * column.

  • fig – A Figure instance. If None, default values are used.

Returns:

A tuple representing (x0, y0, x1, y1) is returned.

The coordinate of axis, (x0, y0, x1, y1), produced by fig.add_subplot(nraw, ncol, iaxis) is returned.

>>> x0, y0, x1, y1 = subplot_coords(2, 2, 3)
>>> print('{:.3f} {:.3f} {:.3f} {:.3f}'.format(x0, y0, x1, y1))   
0.125 0.100 0.477 0.464

This is the coordinates for an axis produced by fig.add_subplot(2, 2, 3).

irfpy.util.plttools.subplot_rect(nraw, ncol, iaxis, fig=None)[source]

Return the rectangle (x, y, w, h).

Similar to subplot_coords(), but returning (x, y, w, h).