Fill contour color into the graph

조회 수: 1 (최근 30일)
Sabella Huang
Sabella Huang 2022년 6월 21일
댓글: DGM 2022년 6월 22일
Hello Guys, I want to make a contour plot on this figure. Would you mind to help me?
theta = [80.86 81.36 81.82 82.38 82.98 83.64 84.28 85.12]
Intensity = [40.62 34.62 32.62 38.62 34.62 31.62 36.62 31.62] %come from theta
theta_line = linspace(0,theta(i),100)';
point_incident = llinspace(0,1,length(theta_line(:,i)))';
The figure that I want like this
Please help me with this. Thank you

답변 (1개)

DGM
DGM 2022년 6월 21일
편집: DGM 2022년 6월 21일
I somehow doubt this is actually what you want, but I'll oblige.
% given
theta = [80.86 81.36 81.82 82.38 82.98 83.64 84.28 85.12]
theta = 1×8
80.8600 81.3600 81.8200 82.3800 82.9800 83.6400 84.2800 85.1200
Intensity = [40.62 34.62 32.62 38.62 34.62 31.62 36.62 31.62]
Intensity = 1×8
40.6200 34.6200 32.6200 38.6200 34.6200 31.6200 36.6200 31.6200
% create lines
npoints = 100;
point_incident = linspace(0,1,npoints);
th_scaled = theta.' .* point_incident;
% create contour data from lines
x = repmat(point_incident,[numel(theta) 1]);
y = th_scaled;
z = repmat(Intensity.',[1 npoints]);
% plot contour
[~,hc] = contourf(x,y,z);
hc.LineStyle = 'none';
colormap(parula)
% plot lines if you want to obscure everything
hold on
plot(point_incident,th_scaled,'w');
% set the axes background to a solid color
set(gca,'color','b')
This looks like a good way to make a graph that's not really readable. If you want to show the intensity profile vs theta at one point, that would at least be readable. The profile is simply scaled at all other points, so you can express it in relative terms.
figure
plot(theta,Intensity)
xlabel('Theta / Point')
ylabel('Intensity')
grid on
That said, I have no idea what this actually describes.
  댓글 수: 2
Sabella Huang
Sabella Huang 2022년 6월 21일
Hello thank you for your comment. The figure is almost close with that I want. In this regard, can I make a gradient color for the background?. Thx
DGM
DGM 2022년 6월 22일
There isn't any data beyond those lines, so there is no contour. You'd have to define that.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Contour Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by