Legend

Hereafter are presented the available options to generate a legend for two dimensional graphs in mathlayer®.

Legend

Options Description Values Default Values
showLegend Allows to select whether the legend of the graph is displayed or not. true or false. false
legendFont Sets the font and size of the labels in the legend. Any number with its units followed by any font. '0.8em arial'
legendLabels Sets the name for each label. A cell array of names. Numbers from 1 to the number of lines.
legendX Sets the absolute position of the legend. A number between 0 and 350. Rigth up corner.
legendY Sets the absolute position of the legend. A number between 0 and 550. Rigth up corner.
legendOpacity Sets the opacity of the canvas. Any value from 0 to 1. 1
legendColor Sets the color of the legend background. Any color in Hex, RGB or HSL representation. 'white'
legendStroke Sets the color of the legend rectangle. Any color in Hex, RGB or HSL representation. 'black'
rectLegend Sets whether the rectangle of the legend will be shown or not. true or false. true
options = struct  

% initializing options struct

options.showLegend = true options.legendLabels = {'area', 'plot', 'scatter'} options.legendFont = '12px calibri' options.legendX = 85 options.legendY = 30 options.legendOpacity = 0.4 options.legendColor = "#e6ffb3" o = struct('show', false) x = 1: 0.1: 10 c1 = area(x, cos(x), o) c2 = plot(x, sin(x), o) c3 = scatter(x, 2*cos(x), o) overlay({c1,c2,c3},options)

Related functions

area | bar | histogram | plot | plotyy | scatter | stem