contour plotting in matlab

Hi
I have plotted a scattered plot and a contour plot (figure attached below). However, the contour plot has unusual curvy edges as marked in the figure. How to avoid these curvy edges and make a smooth color variation.

5 件のコメント

Walter Roberson
Walter Roberson 2021 年 6 月 28 日
After you interpolate, use a low-pass filter?
Bjorn Gustavsson
Bjorn Gustavsson 2021 年 6 月 28 日
What did you see when you looked at the triangulation around one of the intersections between the circle-sections and the horizontal lines?
mukesh bisht
mukesh bisht 2021 年 6 月 28 日
編集済み: Walter Roberson 2021 年 6 月 28 日
I have attached my data and code. Please suggest how to use a low-pass filter. When I look at the intersection it shows dark coloured patches (figgure attached).
Note: In actual figure i have rotated my axes to plot data, but i have not included the roated data in file attached (which doesnt matter here).
Code:
x = D(:,1);y = D(:,2);z = D(:,3);
xv = linspace(min(x), max(x),1000); yv = linspace(min(y), max(y),1000);
[Xm,Ym] = ndgrid(xv, yv);
Zm = griddata(x, y, z, Xm, Ym,'natural');
hold on
figure(15)
contourf(Xm, Ym, Zm, 200, 'LineStyle','none'); colormap jet; colorbar
Bjorn Gustavsson
Bjorn Gustavsson 2021 年 6 月 28 日
You should first figure out why you get these "pricks" in the first place. Then figure out a way to handle that cause. Here's what you should do, explicitly.
On top of your scatterplot plot the edges of all the triangles created by the triangulation used by delaunay, which is used inside the griddata/scatteredinterpolant/triscatteredinterpolant functions, like this:
tri = delaunay(x,y);
clf
% Your call to scatter goes here
hold on
edges = [1 2;2 3;3 1];
for i1 = 1:size(tri,1)
for i2 = 1:3
h = plot(x(tri(i1,edges(i2,:))),y(tri(i1,edges(i2,:))),'b','linewidth',2);
drawnow
set(h,'linewidth',1)
end
end
Then you zoom in onto the edge between the "all-blue" circle-sectors and the lines - there you will see the cause of your problem.
Bjorn Gustavsson
Bjorn Gustavsson 2021 年 6 月 28 日
Well I guess you could also go for a non-linear diffusion-filter but that will be for later when other means to handle your problem is exhausted.

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

回答 (0 件)

カテゴリ

質問済み:

2021 年 6 月 28 日

コメント済み:

2021 年 6 月 28 日

Community Treasure Hunt

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

Start Hunting!

Translated by