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 Center および File ExchangeLinear and Nonlinear Regression についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by