drives      = {'Elmo','EVLSERVO1 in Low Power State - MCU in Standby mode, analog electronics','Revised EVLSERVO1 in Low Power State','Custom Design heavily based on EVLSERVO1'};
idle_power  = [10,      0.9,             0.21,               0.03]; 
x           = 1:numel(drives);

figure;
hold on;

colors = [
    1 0 0;
    1 1 0;    
    0 1 0;   
    0 0 1     
];

bar_handles = gobjects(1, numel(drives));

for i = 1:numel(drives)
    bar_handles(i) = bar(x(i), idle_power(i), 0.5, 'FaceColor', colors(i, :));
end

ax = gca;
ax.XTick = x;
ax.XTickLabel = [];
ax.YGrid = 'on';
ax.FontSize = 14;
ylabel('Idle Power (W)');
title('Idle Power Comparison');

% Add legend with all bars
legend(bar_handles, drives, 'Location', 'northeast', 'FontSize', 12);

% Annotate bars
gains = (idle_power(1) - idle_power) ./ idle_power(1) * 100;
offset = 0.05 * (max(idle_power) - min(idle_power));

for i = 1:numel(idle_power)
    if i == numel(idle_power)
        wattLabel = sprintf('%.0f mW', idle_power(i)*1000);
    else
        wattLabel = sprintf('%.2f W', idle_power(i));
    end

    if i > 1
        gainLabel = sprintf('%.1f%% ↓', gains(i));
        txt = {wattLabel, gainLabel};
    else
        txt = {wattLabel};
    end
    
    text(x(i), idle_power(i) + offset, txt, ...
         'HorizontalAlignment','center', ...
         'VerticalAlignment','bottom', ...
         'FontWeight','bold', ...
         'FontSize',12);
end

hold off;
