mygage(475,1,3000,0,1200,1200,1800,1800,2800,25);
function MakeGage = mygage(value, lowRange,highRange,greenLow,greenHigh,yellowLow,yellowHigh,redLow,redHigh,nTicks)
fullRange = highRange - lowRange;
greenStart = 230 - (360-80) / fullRange * (greenLow - lowRange);
greenEnd = 230 - (360 - 80) / fullRange * (greenHigh - lowRange);
yellowStart = 230 - (360 - 80) / fullRange*(yellowLow - lowRange);
yellowEnd = 230 -(360 - 80) / fullRange * (yellowHigh - lowRange);
redStart = 230 - (360 - 80) / fullRange * (redLow - lowRange);
redEnd = 230 - (360 - 80) / fullRange * (redHigh - lowRange);
tickMove = fullRange / nTicks;
green = [greenStart:-5:greenEnd];
green = green*2*pi/360;
rgreen = ones(1,size(green,2));
polarplot(green, rgreen,'g','LineWidth',16);
hold on
yellow = yellowStart:-5:yellowEnd;
yellow = yellow*2*pi/360;
ryellow = ones(1,size(yellow,2));
polarplot(yellow, ryellow,'y','LineWidth',16);
red = redStart:-5:redEnd;
red = red*2*pi/360;
rred = ones(1,size(red,2));
polarplot(red, rred,'r','LineWidth',16);
valueAngle = 230 - (360-80) / fullRange * (value - lowRange);
rblack = [0:0.1:1];
black = valueAngle * 2 * pi/360 * ones(1,size(rblack,2));
polarplot(black, rblack,'k','LineWidth',5);
ax = gca;
ax.RTickLabel = [];
ax.RGrid = 'off';
width = 280 / nTicks;
tickHold = 0:width:280;
tickHold = tickHold-50;
tickHold = [tickHold(tickHold>=0),tickHold(tickHold<0)+360];
ax.ThetaTick = tickHold;
tickLabels = round([highRange:-tickMove:lowRange],0);
shift = round(50 / width);
tickLabels = circshift(tickLabels,-shift);
ax.ThetaTickLabel = tickLabels;
ax.RLim = [0,1.05];
text(265*2*pi/360,0.8,string(value),'fontSize',20);
hold off
end