How to add percent change in barplot?
Mostrar comentarios más antiguos
Hello everyone and happy new year!
I have a barplot (average deaths per degree of temperature, 30-37oC) to which I want to add the percentage change from bar to bar. Attached you can find the excel file I am proccessing and here is the part of code that produces tha barplot.
Is there an efficient way to do so?
Thanks in advance!
PS. I am on R2019a.
Daily_Data = readtable('Daily_Data_MoT.xlsx');
idx = Daily_Data.Daily_T(:) > 30;
Daily_Data_new = Daily_Data(idx,:);
[G, Temperature] = discretize(Daily_Data_new.Daily_T, 30:37);
d_mean = accumarray(G, Daily_Data_new.Daily_Deaths, [length(Temperature), 1], @mean);
bar(Temperature, d_mean); xlabel('T (oC)'); ylabel('Average deaths');
Respuesta aceptada
Más respuestas (1)
Cris LaPierre
el 4 de En. de 2021
1 voto
You can add a line plot to a bar plot. Just use the hold on command.
If you need it to be on a separate Y scale, look at this example
1 comentario
Daphne PARLIARI
el 4 de En. de 2021
Categorías
Más información sobre Multidimensional Arrays 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!
