How can I incorporate the angle of orientation in my colourmap?

3 ビュー (過去 30 日間)
Sam
Sam 2022 年 2 月 1 日
コメント済み: Turlough Hughes 2022 年 2 月 1 日
Hi,
I am currently producing colourmaps for my degree of orientation data. This data varies between 0-180 degrees. Producing colormaps works nicely, however, I am thinking there might be a better way to demonstrate angle.
Is it possible for each data point to be a line, which represents the angle at said data point? i.e. at 180 degrees, it is a vertical line.
This is my current code for my colormap:
%Import the data in from excel
num = xlsread('ExampleData')
% Reshape the intensity vector into a matrix
[xUnq,~,xIdx] = unique(num(:,1));
[yUnq,~,yIdx] = unique(num(:,2));
zMat = nan(numel(yUnq),numel(xUnq));
zIdx = sub2ind(size(zMat),yIdx,xIdx);
zMat(zIdx) = num(:,3);
% Plot contour
contourf(xUnq,yUnq,zMat)
pcolor(xUnq,yUnq,zMat)
shading interp
colorbar
% Label colour bar
c = colorbar;
c.Label.String = ('Degree of Orientation (\theta)');
ylabel('\mu m')
xlabel( '\mu m')
title('title')
I have attached some example data I have been playing with:

採用された回答

Turlough Hughes
Turlough Hughes 2022 年 2 月 1 日
To represent the orientations with arrows, you could a quiver plot as follows:
%Import the data
data = readmatrix('https://uk.mathworks.com/matlabcentral/answers/uploaded_files/880780/ExampleData.xlsx');
figure()
theta = data(:,3);
quiver(data(:,1),data(:,2),cosd(theta),sind(theta),'LineWidth',2, ...
'AutoScaleFactor', 0.6)
ylabel([char(181) 'm']) % char(181) is just a preference
xlabel([char(181) 'm'])
title('Orientation Map')
axis padded
set(gca,'FontSize',14)
  2 件のコメント
Sam
Sam 2022 年 2 月 1 日
Thank you so much, I wasn't aware of quiver plots - this looks great!
Turlough Hughes
Turlough Hughes 2022 年 2 月 1 日
You can scale the third and fourth inputs to quiver as follows:
data = readmatrix('https://uk.mathworks.com/matlabcentral/answers/uploaded_files/880780/ExampleData.xlsx');
figure()
theta = data(:,3);
s = 0.4;
quiver(data(:,1),data(:,2),s*cosd(theta),s*sind(theta),'LineWidth',2, ...
'AutoScale', 'off', 'MaxHeadSize', 0.1)
axis equal
ylabel([char(181) 'm']) % char(181) is just a preference
xlabel([char(181) 'm'])
title('Orientation Map')
axis padded
set(gca,'FontSize',14)

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

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by