gimage
Place an image with data and paper coordinates
Call signature:
gimage(img, drect=None, prect=None, aspect=1, anchor=0)
Help text:
gimage(img, drect, prect) places an image on a location in the graph specified by both data coordinates and image coordinates.
drect and prect each contain (xleft, ytop, width, height).
For example:
gimage(img, [5, 5, 0, 0], [0, 0, 36, 72])
creates an image of 0.5x1" at data location (5,5).
gimage may also be used to create an image with explicitly square pixels. To do that, specify h_data=0 and h_paper=0 to let w_data and/or w_paper define the image size, or specify w_data=0 and w_paper=0 to let h_data and/or h_paper define the image size.
Specify aspect>1 to make the pixels taller or aspect<1 to make them wider.
If height is automatic, then the image descends from the given point, unless anchor>0, in which case it is lifted by the given fraction of image height. Similarly, if width is automatic, the image extends to the right of the given point, unless anchor>0, in which case it is shifted to the left by the given fraction.
Example:

import qplot as qp

import numpy as np

qp.figure('gimage', 3, 3)

xx1 = np.array([0, 10])

qp.plot(xx1, xx1)

qp.plot(xx1, 10 - xx1)

xx, yy = np.meshgrid(range(10), range(10))

r = xx/10

g = yy/10

b = .5+0*xx

img = np.dstack((r,g,b))

qp.gimage(img, [2, 2, 0, 0], np.array([0, -2, 2, 2])*72)