Borrar filtros
Borrar filtros

How to make a Part a and Part b bar chart

2 visualizaciones (últimos 30 días)
Sally Weston
Sally Weston el 7 de Jun. de 2017
Comentada: Sally Weston el 7 de Jun. de 2017
Hi everyone
I have a set of data that is in a Part A and a Part B style, and I would like to present it in a bar chart. Ideally the category labels would be "Part A" and "Part B", and the bars in Part A would all be one colour and the bars in Part B would all be another colour.
Please help, thanks Sally
So far I have...
Data = [3.13 3.14 3.13 3.13 3.13 3.11 3.12 3.18 3.16 3.16 3.16 3.16 3.15 3.20 3.20;... 3.14 3.14 3.15 3.15 3.18 3.11 3.11 3.11 3.11 3.11 3.12 3.10 3.11 3.12 3.18];
figure b = bar(Data,'grouped');
ylabel('Data')
ylim([3.06 3.22])

Respuestas (1)

KSSV
KSSV el 7 de Jun. de 2017
partA = rand(10,1) ;
partB = rand(10,1) ;
bar(1:10,partA, 'r')
hold on
bar(11:20,partB, 'b')
  1 comentario
Sally Weston
Sally Weston el 7 de Jun. de 2017
Thank you, how would you add the category names? so that "partA" covers bars 1:10?

Iniciar sesión para comentar.

Categorías

Más información sobre Bar Plots en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by