Define Interval in contourf
6 views (last 30 days)
Show older comments
Georg Söllinger
on 18 Mar 2017
Answered: Georg Söllinger
on 9 Apr 2017
Hi all,
I'd like to define the interval, in which contourf plots the lines. I've got data with x-y-z, where the z-values are within [0 1], but I'd like them to appear in levels between [0.5 1]. My attempt was the following:
[c,h] = contourf(meshX1/d_n,meshX2*2/d_n,meshZ,10); % interpolated
caxis([0.499, 1.001])
resulting in essentially the same line spacing, only the colours are adjusted to the defined interval (see picture).
Anyone having an idea? Thanks in advance!
Georg
0 Comments
Accepted Answer
Star Strider
on 18 Mar 2017
See if this works:
v = linspace(0.5, 1, 10); % Define ‘10’ Intervals From ‘0.5’ To ‘1’
[c,h] = contourf(meshX1/d_n, meshX2*2/d_n, meshZ, v); % interpolated
caxis([0.499, 1.001])
Note — I do not have your data so this is UNTESTED CODE. It should work.
2 Comments
Star Strider
on 18 Mar 2017
My pleasure.
I am guessing here. This adds two contours at the minimum and maximum of ‘meshZ’. I cannot test it, so you will have to test it to see if it works:
v = [min(meshZ(:)) linspace(0.5, 1, 10) max(meshZ(:))]; % Define ‘10’ Intervals From ‘0.5’ To ‘1’
More Answers (1)
See Also
Categories
Find more on Data Distribution Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!