How to remove contour line in filled contour plot?

30 views (last 30 days)
UTKARSH VERMA on 31 Aug 2021
Commented: UTKARSH VERMA on 1 Sep 2021
Hi all,
I am plotting a data using contourf but the there is a contour line between the start and end value color even after using the
contourf(x,y,z,'LineStyle','none','linecolor','none')
%or
contourf(x,y,z,'LineStyle','none')
%or
contourf(x,y,z,'linecolor','none')
For example in the attached figure there is a line between dark blue and dark red.
Also, I have tried different colormap but the result is same.

DGM on 31 Aug 2021
Edited: DGM on 31 Aug 2021
Hmm. I didn't think about that. I don't know that it can be done with contourf().
% make a simple linear ramp that cycles
[xx yy] = meshgrid(1:100);
zz = xx;
zz = circshift(zz,[0 -30]);
% this is what happens with contourf()
[~,h] = contourf(xx,yy,zz,9,'linecolor','none');
colormap(jet)
colorbar
% let's try to replicate it with pcolor()
clf; pcolor(xx,yy,zz);
colormap(jet(10)) % set length to number of levels+1
colorbar
That's about right. I think it makes the colorbar easier to read anyway.
UTKARSH VERMA on 1 Sep 2021
Thanks DGM!!
It worked perfectly.

KSSV on 31 Aug 2021
Try:
pcolor(x,y,z) ;
colorbar ;
UTKARSH VERMA on 31 Aug 2021
Hi KSSV,
I tried your suggestion but same problem.
So, I have attached my data and here is the code I am using:
contourf(d{1},d{2},d{3}','LineStyle','none')
ylim([0 38]);
xlim([65 98]);
yticks([0:5:38]);
xticks([65:05:98]);
colormap(hsv) %or use jet
colorbar

Categories

Find more on Contour Plots in Help Center and File Exchange

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by