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

8 次查看(过去 30 天)
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 个评论
Shawn
Shawn 2015-3-16
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')

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Linear and Nonlinear Regression 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by