Lines, Markers, Areas and Bars
Hereafter are presented the available options to customize lines, markers and areas of two dimensional graphs in mathlayer®.
Lines and Markers
| Options | Description | Values | Default Values |
| colors | Sets a group of colors that will be used to draw the lines. | A cell array of colors in Hex, RGB or HSL representation. | {"#3366cc", "#dc3912", "#ff9900", "#109618"...} |
| markerShape | Sets the shape of the marker for each point. | 'Circle', 'Cross', 'Diamond', 'Square', 'Star', 'Triangle' and 'Wye'. | 'Circle' |
| markerFill | Sets the circle's fill color for each point. | Any color in Hex, RGB or HSL representation. | none |
| markerStroke | Sets the circle's color for all points. | Any color in Hex, RGB or HSL representation. A vector of values that will define an individual color for each point. | '#3366cc' (blue) |
| markerStrokeFormat | Used to input dates to define marker colors. | 'date'. | empty |
| markerStrFormDate | Used to input a vector of dates to define individual colors for each point. | All formats allowed in d3 library. | '%Y-%m-%d' |
| markerSize | Sets the circle's radium for each point. | Any numeriacal value. | scatter: 3 other plotting functions: 0 |
| copyData | Sets the content displayed when hover over each marker. By clicking on the marker the content will be copied on the clipboard. | Cell array of strings. | empty |
| lineWidth | Sets the width of the line. | Any natural number. | plot and plotyy: 1 other plotting functions: 0 |
| lineStroke | Sets the color of the line. | Any color in Hex, RGB or HSL representation. | Defined in option.colors. |
| lineFill | Sets the fill color of the area inside the line. | Any color in Hex, RGB or HSL representation. | none |
| lineInterpolate | Sets the interpolation mode to the line. | 'Linear', 'LinearClosed', 'MonotoneX', 'MonotoneY', 'Natural', 'Step', 'StepAfter' and 'StepBefore'. | 'Linear' |
| dashArray | Sets a dashed line. | Two numbers: the first sets the line length and the second sets the space length. | none |
x = [1 2 3]
y = [2 5 0]
op = struct % initializing options struct
op.markerShape = 'Square'
op.markerSize = 7
op.markerFill = 'orange'
op.markerStroke = 'black'
op.lineWidth = 2
op.lineStroke = '#663300'
op.lineFill = 'lightblue'
op.dashArray = '4 8'
op.lineInterpolate = 'BasisClosed'
op.copyData = {'';'squared';'third
point'}
plot(x,y,op)
Areas
| Options | Description | Values | Default Values |
| areaStroke | Sets a color to fill the area under a ploted line. | Any color in Hex, RGB or HSL representation. | 'lightsteelblue' |
| areaAboveStroke | Sets a color to fill the area under a ploted line and above the base lavel. | Any color in Hex, RGB or HSL representation. | 'lightsteelblue' |
| areaBelowStroke | Sets a color to fill the area under a ploted line and below the base lavel. | Any color in Hex, RGB or HSL representation. | 'lightsteelblue' |
| areaColors | Sets a group of colors that will be used to fill the stacked areas under ploted lines. | A cell array of colors in Hex, RGB or HSL representation. | {"#3366cc", "#dc3912", "#ff9900", "#109618"...} |
| areaOpacity | Sets the opacity of the colored area. | Any value from 0 to 1. | 1 |
| areaBase | Sets the line where the colored area finish. | Any numeriacal value. | 0 |
options = struct% initializing options struct
options.areaColors = {'#79d2a6','#339966'} options.lineStroke = '#194d33' options.areaBase = -0.5 x = -2*pi:0.1:2*pi y = [sin(x)./x;(sin(x)./x)+0.5] area(x, y',options)
Bars
| Options | Description | Values | Default Values |
| barStroke | Sets the color of the bar's lines. | Any color in Hex, RGB or HSL representation. | 'black' |
| barStrokeWidth | Sets the width of the bars's lines. | Any natural number. | 1 |
| barFill | Sets the color of the bars. For groups of bars use areaColors. | Any color in Hex, RGB or HSL representation. | 'lightsteelblue' |
| barWidth | Sets the width of the bars. | Any natural number from 0.1 to 1. | 0.8 |
| barBase | Sets the line where the bars begin. | Any numeriacal value. | 0 |
| barOpacity | Sets the opacity of the bars. | Any value from 0 to 1. | 1 |
| barStack | Sets if groups of bars will be stacked or not. | true or false. | false |
opt = struct% initializing options struct
opt.areaColors = {'#339966','orange'} opt.barWidth = 0.6 opt.barStroke = 'blue' opt.barStrokeWidth = 2 opt.barBase = 2 opt.barOpacity = 0.6 opt.barStack = false x = 10:15 y = [5 7 4 1 6 3; 4 3 6 0.55 5 4] bar(x, y, opt)