Hello everyone,
I want to plot smooth contour filled data with the given data. I have tried this code.
h1=contourf(X1,X2,DATA1,'edgecolor','none');
shading interp;
with this I am getting this plot. But I want a smooth plot. I would really appreciate your help. Thanks in advance.

댓글 수: 7

DGM
DGM 2022년 3월 23일
That blockiness is in the data itself -- or at least the data that's attached.
Subhodh Sharma
Subhodh Sharma 2022년 3월 23일
@DGM the blockiness is in the data itself (that's the main reason as I see). I was trying to increase the points using interp2 method. But not much improvement I observe on the contour plot. Looking forward to your suggestions.
Adam Danz
Adam Danz 2022년 3월 23일
Have you tried increasing the number of levels in contourf(___,levels) ?
If it is appropriate you could try some simple smoothing filtering:
h1=contourf(X1,X2,imfilter(ans,conv2(ones(3)/3^3,ones(5)/5^2,'full')),'edgecolor','none');
But if that is appropriate is for you to decide - for this simple case the northeastern part of India gets cut-off due to the width of the filter-kernel compared to how many pixels worth of data you have finite data in that region.
Subhodh Sharma
Subhodh Sharma 2022년 3월 23일
@@Adam Danz thanks. Tried with levels but not much improvement I observed.
Subhodh Sharma
Subhodh Sharma 2022년 3월 23일
@Bjorn Gustavsson I am not familiar witb filtering. But we can use filtering if it solves the issue. only thing is that I need to show all portion of Indian region without cut-offs of any region.
thanks for your response. looking forward to your inputs.
The underlying problem might be the data you have in DATA1, if I simply do:
imagesc(DATA1)
and zoom in on the Kashmir(?) region it looks very peculiar, some kind of mixture between rasterized data and interpolated data on varying spatial resolution. The answer by Mathieu below looks nice to my eyes, if they are a suitable presentation of the data is for you to judge.

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

 채택된 답변

Mathieu NOE
Mathieu NOE 2022년 3월 23일

2 개 추천

hello
with this FEx submission, you should be happy now
DATA2 = smooth2a(DATA1,10,10); % adapt the smoothing amount to your needs...
figure(2)
h2=contourf(X1,X2,DATA2,'edgecolor','none');
results

댓글 수: 2

Subhodh Sharma
Subhodh Sharma 2022년 3월 24일
@Mathieu NOE thanks man. It worked like wonder.
Mathieu NOE
Mathieu NOE 2022년 3월 24일
My pleasure !

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Contour Plots에 대해 자세히 알아보기

제품

릴리스

R2017b

질문:

2022년 3월 23일

댓글:

2022년 3월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by