legopt
Set options for legend and friends
Call signature:
legopt(x0=None, y0=None, skip=15, height=9, width=18, indent=9, color='k', drop=3, dx=0, dy=0)
Help text:
legopt specifies options for legend rendering.
All arguments are optional:
x0x position of left edge of legend, in data coordinates
y0y position of middle of top legend element, in data coordinates
skipbaselineskip (in points) between elements
heightheight (in points) of rendered patches
widthwidth (in points) of rendered lines and patches
indentspace between rendered samples and following text
colorcolor for following text
dropvertical distance between middle of samples and text baseline
dx, dyadditional 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.
Example:

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, .01)

qp.pen('none')

qp.brush('b', .5)

qp.bars(xx, np.cos(xx), .01)

qp.plegend('Cosine')

qp.brush('r', .5)

qp.bars(xx, np.sin(xx), .01)

qp.plegend('Sine')

qp.shrink()