How to Add a Marker (say an asterisk) to a Hist3 Plot

3 views (last 30 days)
I am trying to add asterisks to my histograms to mark various important points. Currently, I use the following code for my histograms:
wn1 = 21*rand(100000,1);
zeta1 = 100*rand(100000,1);
wn1zeta1_matrix = [wn1 zeta1];
hist3(wn1zeta1_matrix,'Edges',{0:5.25:21 0:5:100})
colorbar
set(gcf,'renderer','zbuffer');
set(get(gca,'child'),'FaceColor','interp','CDataMode','auto');
axis([0 21 0 100])
% set(gca,'YTick',[-14 -10 -5 0 5 10 15])
xlabel('{\omega}_n (rad/s)')
ylabel('{\zeta} (%) ','rot',0)
title('Histogram of Damping Ratio versus Natural Frequency')
set(gca,'FontSize',10,'fontWeight','bold')
set(findall(gcf,'type','text'),'FontSize',10,'fontWeight','bold')
I tried using the insertMarker command to no avail.
insertMarker(gcf,[147 279],'*')
How might I add, for example, an asterisk at the point (1,1)?
  1 Comment
Shawn
Shawn on 16 Mar 2015
I was able to figure it out. I added a part for a line(plot3) and for a marker (scatter3).
wn1 = 21*rand(100000,1);
zeta1 = 100*rand(100000,1);
wn1zeta1_matrix = [wn1 zeta1];
hold on
hist3(wn1zeta1_matrix,'Edges',{0:5.25:21 0:5:100})
N=hist3(wn1zeta1_matrix,'Edges',{0:5.25:21 0:5:100});
maxN = max(N(:));
colorbar
set(gcf,'renderer','zbuffer');
set(get(gca,'child'),'FaceColor','interp','CDataMode','auto');
scatter3([1.5 1.5], [1.5 1.5],[maxN maxN],25,'w*'); %adds a marker
plot3([0 0.4246*100], [0.4246*100 0],[maxN maxN],'w','LineWidth',1); %adds a line
hold off
axis([0 21 0 100])
% set(gca,'YTick',[-14 -10 -5 0 5 10 15])
xlabel('{\omega}_n (rad/s)')
ylabel('{\zeta} (%) ','rot',0)
title('Histogram of Damping Ratio versus Natural Frequency')
set(gca,'FontSize',10,'fontWeight','bold')
set(findall(gcf,'type','text'),'FontSize',10,'fontWeight','bold')

Sign in to comment.

Answers (0)

Categories

Find more on Data Distribution Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!