Module plottools.legend
Enhance legend text.
Enhanced axes member functions
legend(): legend function with LaTeX support.
Settings
legend_params(): set default parameter for the legend module.
Install/uninstall legend functions
You usually do not need to call these functions. Upon loading the legend
module, install_legend() is called automatically.
install_legend(): install functions of the legend module in matplotlib.uninstall_legend(): uninstall all code of the legend module from matplotlib.
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
Noneare updated.Call this function before you create any matplotlib figure.
Parameters
fontsize:floatorstring- 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:floatorNone- Space between columns in font size units.
Sets rcParam
legend.columnspacing.
def install_legend()def uninstall_legend()-
Uninstall code for legend.
Call this code to disable anything that was installed by
install_legend().See Also
def demo(usetex=False)-
Run a demonstration of the legend module.
Parameters
usetex:bool- If
Trueuse LaTeX mode.