Shade area in graph for multiple y-axes
Mostrar comentarios más antiguos
Hi,
I need to shade an arrea of my graph, namely from x-values 552 to 586. In order to do so I used the following code:
%data_final
min = cell2mat(data_final(:,1));
CGM = cell2mat(data_final(:,2));
CGMi = smooth(CGM);
figure(1)
patch([552 586 586 552], [0 0 max(ylim)*[1 1]], [0.8 0.8 0.8])
yyaxis left
plot(min,CGMi);
HR = cell2mat(data_final(:,3));
HRi = smooth(HR);
yyaxis right
plot(min,HRi);
yyaxis left
title('CGM and HR data for a single day')
xlabel('Minutes')
ylabel('CGM [mmol/L]')
yyaxis right
ylabel('HR [bpm]')
However, this does not seem to work for multiple y-axes. Can anybody help me fix this while keeping the y-axes correct?
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Just for fun en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
