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

조회 수: 6 (최근 30일)
Shawn
Shawn 2015년 3월 13일
댓글: Shawn 2015년 3월 16일
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