Axes
Hereafter are presented the available axis options for two dimensional graphs in mathlayer®.
Axes lines
Options | Description | Values | Default Values |
axisSpacing | Moves x-axis up or down and y-axis right or left. | Positive or negative numerical values. | 0 |
useSecondaryAxis | Sets a secondary y-axis. | true or false. | false |
xAxisShow yAxisShow showSecondaryAxis | Show or hide axes. | true or false. | x-axis and y-axis: true secondaryAxis: false |
xAxisMin yAxisMin y2AxisMin | Set the minimum value for each axis. | Positive or negative numerical values. | Minimum of the input values. |
xAxisMax yAxisMax y2AxisMax | Set the maximum value for each axis. | Positive or negative numerical values. | Maximum of the input values. |
xAxisScale yAxisScale y2AxisScale | Set the scale for each axis. | 'Linear' and 'Log'. | 'Linear' |
o = struct% initializing options struct
o.useSecondaryAxis = true o.xAxisShow = false o.y2AxisMin = -1 x = (-15:0.1:5)' plot([x],[airy(x) sin(x)],o)
Axes ticks
Options | Description | Values | Default Values |
xAxisTicks yAxisTicks y2AxisTicks | Set the number of ticks of each axis. | Any natural number. | 11 |
xAxisFont yAxisFont y2AxisFont | Set the font and size of the tick's text. | Any number with its units followed by any font. | '0.7em arial' |
xAxisColor yAxisColor y2AxisColor | Set the color of the tick's text. | Any color in Hex, RGB or HSL representation. | 'black' |
xAxisLabels yAxisLabels y2AxisLabels | Set the labels for each tick. | A cell array of names. | empty |
xAxisTextAnchor yAxisTextAnchor y2AxisTextAnchor | Define where the text starts with respect to each tick. | 'start', 'middle' or 'end'. | 'middle' |
xAxisRotate yAxisRotate y2AxisRotate | Rotate the text of each tick. | Any numeriacal value (degrees). | 0 |
xAxisFormat yAxisFormat y2AxisFormat | Used to input dates as axes labels. | 'date'. | empty |
xAxisDateFormat yAxisDateFormat y2AxisDateFormat | Set the format of the displayed dates. | All formats allowed in d3 library. | '%Y-%m-%d' |
o = struct% initializing options struct
o.yAxisTicks = 8 o.xAxisFont = '0.7em calibri' o.xAxisColor = '#993d00' o.xAxisTextAnchor = 'end' o.xAxisRotate = 25 o.xAxisFormat = 'date' o.xAxisDateFormat = '%d/%m/%Y' x = {'18/03/2015','19/03/2015','20/03/2015','21/03/2015','22/03/2015','23/03/2015','24/03/2015'} y = [1 5 2 8 3 4 2] plot(datenum(x, 'mm/dd/yyyy'),y,o)
o = struct% initializing options struct
o.xAxisTicks = 7 o.yAxisTicks = 8 o.xAxisLabels = {'Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'} o.xAxisTextAnchor = 'start' o.xAxisRotate = -60 x = [1 2 3 4 5 6 7] y = [1 5 2 8 3 4 2] plot(x,y,o)
Axes names
Options | Description | Values | Default Values |
xAxisName yAxisName y2AxisName | Set a name for each axis. | Any name. | empty |
xAxisNameFont yAxisNameFont y2AxisNameFont | Set the font and size of the name of each axis. | Any number with its units followed by any font. | '0.9em arial' |
xAxisNameColor yAxisNameColor y2AxisNameColor | Set the color of the name of each axis. | Any color in Hex, RGB or HSL representation. | 'black' |
o = struct% initializing options struct
o.xAxisName = 'xValues' o.yAxisName = 'cosine' o.xAxisNameFont = '0.9em calibri' o.yAxisNameColor = '#ffa366' x = -10:0.1:10 plot(x,cos(x),o)