【发布时间】:2017-05-12 08:14:14
【问题描述】:
我想在条形图中绘制标量 TEV_Idz 和 TEV_TF。
问题 1:我想查看两种不同颜色的两个标量的图例,但我最终只得到两个条形图具有相同蓝色的图例。
问题 2:我正在尝试获取每个标量在其各自柱上的值,但我无法使用以下函数生成输出。
这是我的输出:
这是我的代码:
TEV_plot = bar([TEV_Idz;TEV_TF], 0.6);
grid on;
set(gca, 'yTickLabel',num2str(100.*get(gca,'yTick')','%g%%'));
% PROBLEM 1: The code for having a legend
ii = cell(1,2);
ii{1}='L'; ii{2}='B'; %first bar called L and second bar called B
legend(TEV_plot,ii); %mylegend
%PROBLEM 2: This is my code for plotting the value of each scalar on the top of the every bar graph.
for k = 1:numel(TEV_plot)
text(k, TEV_plot(k), {num2str(TEV_plot(k)), ''}, ...
'HorizontalAlignment', 'center', ...
'verticalalignment', 'bottom')
end
【问题讨论】: