Mark smallest bar in 3-D bar plot

1 view (last 30 days)
Luc Kloosterman
Luc Kloosterman on 1 Sep 2020
Answered: Dana on 1 Sep 2020
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)))

Answers (1)

Dana
Dana on 1 Sep 2020
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.

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!