legopt(x0=None, y0=None, skip=None, height=None, width=None, indent=None, color=None, drop=None, dx=None, dy=None)
legopt specifies options for legend rendering.
All arguments are optional:
x0 - x position of left edge of legend, in data coordinates
y0 - y position of middle of top legend element, in data coordinates
skip - baselineskip (in points) between elements
height - height (in points) of rendered patches
width - width (in points) of rendered lines and patches
indent - space between rendered samples and following text
color - color for following text
drop - vertical distance between middle of samples and text baseline
dx, dy - additional horizontal and vertical displaced, in points All have sensible defaults, except x0 and y0, which default to (0, 0).
Legend elements are automatically rendered one below the other starting at y0.
import qplot as qp
import numpy as np
qp.figure('legopt', 3, 3)
qp.legopt(x0=2*np.pi, y0=1, dx=10, height=16, skip=20, drop=5)
qp.font('Helvetica', 16)
xx = np.arange(0, 2*np.pi, .1)
qp.pen('none')
qp.brush('b', .5)
qp.bars(xx, np.cos(xx), .1)
qp.legopt(color='b')
qp.plegend('Cosine')
qp.brush('r', .5)
qp.bars(xx, np.sin(xx), .1)
qp.legopt(color='r')
qp.plegend('Sine')
qp.shrink()