Mark smallest bar in 3-D bar plot

1 次查看(过去 30 天)
Luc Kloosterman
Luc Kloosterman 2020-9-1
回答: Dana 2020-9-1
I have a 3d bar plot where the height of a bar resembles the mean squared error of a function estimator. Wit my code I find the combination of simplex and order which results in the lowest mean squared error which is 6 and 5 respectively. The color of the bars is already in corresponding to its height, however due to the small varaition it is not visible which is actually the smallest. Therefore, I would like to put a marker (arrow, diamond, etc) on the smallest bar.
figure(2)
bar = bar3(mse_mat);
for i = 1:size(mse_mat,2)
zdata = ones(6*size(mse_mat,1),4);
k = 1;
for j = 0:6:(6*size(mse_mat,1)-6)
zdata(j+1:j+6,:) = mse_mat(k,i);
k = k+1;
end
set(bar(i),'Cdata',zdata)
end
xlabel('Simplex order')
ylabel('Number of simplices')
yticks((2:2:max_simplices)/2)
yticklabels(split(num2str(2:2:max_simplices)))

回答(1 个)

Dana
Dana 2020-9-1
My default built-in function for drawing arrows in plots is annotation but I believe that only works in 2-D. As a work-around for 3-D, you can probably make something happen with the text function (using the x,y,z syntax). You could also try the arrow function from the File Exchange.

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

标签

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by