有没有可能在matlab的XData轴上输入字符而不是数字?例如,在此图表中,
我想将X轴的1 2 3
替换为string 1 string 2 string 3
。
我的代码是
a=bardata ;
b=barerror ;
ctrs = 1:3;
data = a;
figure(1)
hBar = bar(ctrs, data);
markers = {'x','o','^'};
ctr = [];
ydt = [];
for k1 = 1:size(a,2)
ctr(k1,:) = bsxfun(@plus, hBar(1).XData, [hBar(k1).XOffset]');
ydt(k1,:) = hBar(k1).YData;
end
hold on
errorbar(ctr', ydt', b, '.r')
legend({'Version 1', 'Version 2'}, 'location', 'northeast');
hold off
https://stackoverflow.com/questions/51463902
复制相似问题