Gauge Plots in MATLAB®

How to make Gauge Plots in MATLAB® with Plotly.


Create Circular Gauge

fig = uifigure;
cg = uigauge(fig);

fig2plotly()

Create Linear Gauge

fig = uifigure;
lg  = uigauge(fig,'linear');

fig2plotly()

Create Linear Gauge in Panel

Specify a panel as the parent container for a linear gauge.

fig = uifigure;
pnl = uipanel(fig);
lg = uigauge(pnl,'linear');

fig2plotly()

Set and Access Gauge Property Values

Create a circular gauge, and set the ScaleDirection property to specify that the needle moves counterclockwise.

fig = uifigure;
cg = uigauge(fig,'ScaleDirection','counterclockwise');

Change the number of major ticks, specify matching tick labels, and remove minor ticks.

cg.MajorTicks = [0:10:100];
cg.MajorTickLabels = {'0','10','20','30','40','50','60','70','80','90','100'};
cg.MinorTicks = [];

fig2plotly()

Specify Scale Colors and Color Limits

fig = uifigure;
cg = uigauge(fig,'ScaleColors',{'yellow','red'},...
                 'ScaleColorLimits', [60 80; 80 100]);

fig2plotly()