Clear Filters
Clear Filters

Change clabel stacking order

1 view (last 30 days)
Alli Whalley
Alli Whalley on 31 Oct 2020
Hi,
I'm adding clabels to my contourf plot. There are some areas where the labels are stacked on top of each other so you can't see the ones below. I'm ok with this, but I'd like the extreme values to be visible. Currently, they are stacked from low to high, so my positive extreme values are visible but my negative extremes get lost underneath.
This is my current code (which doesn't work):
[y,z] = contourf(ax(1),pos.y1/H,pos.z1/H,zdata(pos.n1),cmap,'showtext','on','linestyle',':'); %plotting
negV = flip(cmap(1:24)); %reordering the vector so extreme neg values occur later (hoping they'll stack on top)
posV = cmap(25:length(cmap));
v = [negV,posV]; %putting them back together
clabel(y,z,v,'fontsize',5,'margin',0.1,'BackGroundColor',[1 1 1],'EdgeColor',[0 0 0],'linewidth',0.1) %adding labels
This is what one of my plots looks like. You can see how the larger negative values are stacked below the smaller negative values.
Thanks!

Answers (0)

Categories

Find more on Contour Plots in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!