Biomech-Sim-Toolbox 1
Toolbox for movement simulation and analysis
Loading...
Searching...
No Matches
Functions
addLegend.m File Reference

Function to add the legend for a plot. More...

Functions

function addLegend (in allHandels, in allEntries, in allFaceAlphas, in legendFontSize)
 Function to add the legend for a plot.
 

Detailed Description

Function to add the legend for a plot.

Details: addLegend()

Author
Marlies Nitschke
Date
September, 2018

Function Documentation

◆ addLegend()

function addLegend ( in  allHandels,
in  allEntries,
in  allFaceAlphas,
in  legendFontSize 
)

Function to add the legend for a plot.

By default, Matlab does not set a face alpha for the icon of patches in the legend. In this function the face alpha value is set. However, the value has to be known and has to be given as input in allFaceAlphas.

The legend interpreter is set to Latex.

Example how to call this function:

allHandels = [hSim, hTrackAV, hTrackSD];
allEntries = {'Simulated', 'Tracked mean', 'Tracked mean $\pm$ SD'};
legendFontSize % by default is legendFontSize = 9;
allFaceAlphas = [nan, nan, trackFaceAlpha]; % with e.g. standingFaceAlpha = 0.1;
lgnd = addLegend(allHandels, allEntries, allFaceAlphas);
function addLegend(in allHandels, in allEntries, in allFaceAlphas, in legendFontSize)
Function to add the legend for a plot.
Parameters
allHandelsHandle array: All handles which should get an entry
allEntriesCell array of Strings: All legend entries (size of allHandels)
allFaceAlphas(optional) Double array: Containing the alpha values for the each patch and NaNs for other legend entries. If it is not given the alpha values in the legend will not be set. (size of allHandels)
legendFontSize(optional) Double: Legend font size (by default, legendFontSize = 9)
Return values
lgndmatlab.graphics.illustration.Legend: Handle of the legend