Borrar filtros
Borrar filtros

Change color of bar graphs?

1 visualización (últimos 30 días)
Muhammad Tarique
Muhammad Tarique el 4 de Jul. de 2022
Respondida: Chunru el 4 de Jul. de 2022
so I am using following code for my bar graph
y = [0.1064 0.1069 0.1084 0.1113 0 0.1130 0.1165 0.1189 0.1217];
barh(y)
yticklabels({'rbio3.5','rbio3.7','rbio3.9','rbio3.3','-','bior3.5','rbio1.3','rbio2.8','db4'})
and I am getting this result but what I want is to change color of last 4 bars how can i do so?

Respuesta aceptada

Chunru
Chunru el 4 de Jul. de 2022
y = [0.1064 0.1069 0.1084 0.1113 0 0.1130 0.1165 0.1189 0.1217];
b = barh(y);
b.FaceColor = 'flat';
b.CData(1:4, :) = repmat([1 0 0], [4 1]); % [1 0 0] for red
yticklabels({'rbio3.5','rbio3.7','rbio3.9','rbio3.3','-','bior3.5','rbio1.3','rbio2.8','db4'})

Más respuestas (0)

Categorías

Más información sobre Discrete Data 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