Module plottools.legend

Enhance legend text.

Enhanced axes member functions

  • legend(): legend function with LaTeX support.

Settings

Install/uninstall legend functions

You usually do not need to call these functions. Upon loading the legend module, install_legend() is called automatically.

Functions

def legend(ax, *args, **kwargs)

Legend function with LaTeX support.

Uses latex.translate_latex_text() to improve LaTeX mode of legend labels.

Parameters

Same as mpl.axes.Axes.legend().

def legend_params(fontsize=None, frameon=None, borderpad=None, handlelength=None, handletextpad=None, numpoints=None, scatterpoints=None, labelspacing=None, columnspacing=None)

Set default parameter for the legend module.

Only parameters that are not None are updated.

Call this function before you create any matplotlib figure.

Parameters

fontsize : float or string
Set font size for legend. Either the font size in points, or a string like 'medium', 'small', 'x-small', 'large', 'x-large'. Sets rcParam legend.fontsize.
frameon : bool
Control whether to show a frame around the legend or not. Sets rcParam legend.frameon.
borderpad : float
Whitespace between legend and frame in font size units. Sets rcParam legend.borderpad.
handlelength : float
Length of the legend handles in font size units. Sets rcParam legend.handlelength.
handletextpad : float
White space between legend handles and text in font size units. Sets rcParam legend.handletextpad.
numpoints : int
The number of marker points in the legend handle. Sets rcParam legend.numpoints.
scatterpoints : int
The number of scatter points in the legend handle. Sets rcParam legend.scatterpoints.
labelspacing : float
Vertical space between legend entries in font size units. Sets rcParam legend.labelspacing.
columnspacing : float or None
Space between columns in font size units. Sets rcParam legend.columnspacing.
def install_legend()

Patch the mpl.axes.Axes.legend() function.

See Also

uninstall_legend()

def uninstall_legend()

Uninstall code for legend.

Call this code to disable anything that was installed by install_legend().

See Also

install_legend()

def demo(usetex=False)

Run a demonstration of the legend module.

Parameters

usetex : bool
If True use LaTeX mode.