フィルターのクリア

How can I display text on pcolor map like in the image below?

5 ビュー (過去 30 日間)
Basiq
Basiq 2022 年 4 月 28 日
コメント済み: Basiq 2022 年 4 月 28 日
How can I display these numbers on my pcolor map?

採用された回答

Chunru
Chunru 2022 年 4 月 28 日
L = membrane(1, 100);
s=pcolor(L);
s.EdgeColor='none';
set(gca, 'YDir', 'reverse')
xl = xlim;
yl = ylim;
n = 1;
xy =[];
for i=1:7
iodd = mod(i, 2);
for j=1:7
jodd = mod(j, 2);
if (iodd && ~jodd) || ~iodd && jodd
xy = [xy; j, i];
end
end
end
%map to xlim and ylim
xy(:, 1) = xl(1) + xy(:, 1) * diff(xl)/8;
xy(:, 2) = yl(1) + xy(:, 2) * diff(yl)/8;
text(xy(:,1), xy(:, 2), string(1:24))
  2 件のコメント
Basiq
Basiq 2022 年 4 月 28 日
Thanks!
Basiq
Basiq 2022 年 4 月 28 日
Thanks for your guidance.

サインインしてコメントする。

その他の回答 (1 件)

Bjorn Gustavsson
Bjorn Gustavsson 2022 年 4 月 28 日
If you have your text-strings and their respective location you should be able to do this brute-force:
pcolor(X,Y,Z),shading interp
x4t = randn(1,23); % positions just for this example
y4t = randn(1,23); % rather stupid locationing of text
text4labels = 'a':'w'; % not much of information either
fntsz = 15;
fntw = 'bold'
for iT = numel(text4labels):-1:1,
thl(iT) = text(x4t(iT),y4t(iT),text4labels(iT),'fontsize',fntsz,'fontweight',fntw);
end
You'll have to modify the locations and texts to produce anything sensible.
HTH

カテゴリ

Help Center および File ExchangeGeographic Plots についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by