Alphabetical list Categories
legend Render legend element for plotted line
Call signature:

legend(s)

Help text:

legend(str) renders a sample of the most recently plotted line at the location set by legopt and writes the given string next to it.
See also mlegend and plegend.

Example:

import qplot as qp

import numpy as np

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

qp.legopt(x0=2*np.pi, y0=1, dx=10)

xx = np.arange(0, 2*np.pi, .1)

qp.pen('b')

qp.plot(xx, np.cos(xx))

qp.legend('Cosine')

qp.pen('r')

qp.plot(xx, np.sin(xx))

qp.legend('Sine')

qp.shrink()

QPlot Documentation — (C) Daniel Wagenaar, 2014–2023