problem with the name and colors of function bar
1 回表示 (過去 30 日間)
古いコメントを表示
hi i have this 2 vectors:
R=[0.653368446507723 0.679697416448178 0.498095754312123 0.769842809543479 0.548071337734980 0.741418460004374 0.144309508936660 0.746265427699817]
R2=[0.904344447236355 0.690899146493319 0.813308148441499 0.843404154734088 0.741462108425587 0.743992344988688 0.909516353481475 0.798106660693771 0.914039689234528 0.903749068840837 0.905460998596729 0.681770311602557 0.781886210141303 0.802675616361085 0.612994051471877 0.765830161043075 0.535374786223527 0.859204916375148 0.830628655340404 0.791351283447683 0.870604507634522 0.898272536183366 0.764222229874867 0.647746437097374 0.899728115484892 0.742034443459772 0.915234758056906 0.762508436811915]
the xticklabels is
R={'Loudness','FLucStr','Roughness','Sharpness','Leq','Sil','Tonality','Kurtosis'}
and the color is red
the xticklabels of
R2={'Loudness - FLucStr','Loudness - Roughness','Loudness - Sharpness','Loudness - Leq','Loudness - Sil','Loudness - Tonality','Loudness - Kurtosis', 'FLucStr - Roughness','FLucStr - Sharpness','FLucStr - Leq','FLucStr - Sil','FLucStr - Tonality','FLucStr - Kurtosis','Roughness - Sharpness','Roughness - Leq', 'Roughness - Sil','Roughness - Tonality','Roughness - Kurtosis','Sharpness - Leq','Sharpness - Sil','Sharpness - Tonality','Sharpness - Kurtosis','Leq - Sil','Leq - Tonality', 'Leq - Kurtosis','Sil - Tonality','Sil - Kurtosis','Tonality - Kurtosis'}
and the color is blue.
how can i create only 1 bar graphic with R and R2 in an unique graphic in sequence with relave xticklabels and colors???
0 件のコメント
回答 (1 件)
Gaurav Garg
2019 年 9 月 19 日
R1=[0.653368446507723 0.679697416448178 0.498095754312123 0.769842809543479 0.548071337734980 0.741418460004374 0.144309508936660 0.746265427699817];
R2=[0.904344447236355 0.690899146493319 0.813308148441499 0.843404154734088 0.741462108425587 0.743992344988688 0.909516353481475 0.798106660693771 0.914039689234528 0.903749068840837 0.905460998596729 0.681770311602557 0.781886210141303 0.802675616361085 0.612994051471877 0.765830161043075 0.535374786223527 0.859204916375148 0.830628655340404 0.791351283447683 0.870604507634522 0.898272536183366 0.764222229874867 0.647746437097374 0.899728115484892 0.742034443459772 0.915234758056906 0.762508436811915];
f=bar(1:2:15, R1,0.25);
hold on;
[2:2:16,17:36] ;
bar(ans, R2,0.25);
xtick1={'Loudness','FLucStr','Roughness','Sharpness','Leq','Sil','Tonality','Kurtosis'} ;
xtick2={'Loudness - FLucStr','Loudness - Roughness','Loudness - Sharpness','Loudness - Leq','Loudness - Sil','Loudness - Tonality','Loudness - Kurtosis', 'FLucStr - Roughness','FLucStr - Sharpness','FLucStr - Leq','FLucStr - Sil','FLucStr - Tonality','FLucStr - Kurtosis','Roughness - Sharpness','Roughness - Leq', 'Roughness - Sil','Roughness - Tonality','Roughness - Kurtosis','Sharpness - Leq','Sharpness - Sil','Sharpness - Tonality','Sharpness - Kurtosis','Leq - Sil','Leq - Tonality', 'Leq - Kurtosis','Sil - Tonality','Sil - Kurtosis','Tonality - Kurtosis'};
for i=1:8
temp((2*i)-1)=xtick1(i);
temp((2*i))=xtick2(i);
end
ctr=17;
for i=9:28
temp(ctr)=xtick2(i);
ctr=ctr+1;
end
set(gca, 'XTick',1:36)
set(gca,'XTickLabel',temp);
temp
The above code shall answer your question.
temp variable stores the values at xtick labels.
set (‘XTickLabel’) sets the xtick labels appropriately.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Graphics Object Programming についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!