Smooth edge on contour plot
Ältere Kommentare anzeigen
Hello,
In my contourf plot, I want to cut off values above a certain limit, 61 in this case. In the attached figure, I want to have the figure on the right to look like the figure on the left upto the 61 line. However if I set these values to either zero or nan, the edge will always be tapered. Is there a way display the edge like a smooth contour line, like all others in the figure?
Thanks in advance!
The figure on the left is created by
figure()
contourf(W_chh*10^6,W_ww*10^6,(Twout'))
colorbar
The figure on the right is created by
figure()
Twout(Twout >= 61) = nan;
contourf(W_chh*10^6,W_ww*10^6,(Twout'))
colorbar
7 Kommentare
ADSW121365
am 15 Jun. 2020
You might be able to force the behaviour by plotting the full graph, then setting an xlim to crop out the extra part of the graph without deforming your curves.
Lars Peters
am 15 Jun. 2020
Bearbeitet: Lars Peters
am 15 Jun. 2020
If you want the colors to have the same definition for both plots, you can set the color limits of the second axes to have a range from ~56 to 64 or whatever the range is in the first plot. Currently, "yellow-ish" means ~63 on the plot on the left but the same exact color means ~60 on the plot on the right.
Lars Peters
am 15 Jun. 2020
Adam Danz
am 15 Jun. 2020
It sounds like the step-like contour edge at level 61 is part of your data and you want to modify that controur line as if your data doesn't have that feature in it. I'll update my answer with an alternative.
Lars Peters
am 15 Jun. 2020
Adam Danz
am 15 Jun. 2020
My updated answer suggests to plot the contour lines without modifying the inputs. Then, after the contrours are plotted, remove the levels greater than your threshold.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Contour Plots finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!