フィルターのクリア

Define Interval in contourf

4 ビュー (過去 30 日間)
Georg Söllinger
Georg Söllinger 2017 年 3 月 18 日
回答済み: Georg Söllinger 2017 年 4 月 9 日
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

採用された回答

Star Strider
Star Strider 2017 年 3 月 18 日
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 件のコメント
Georg Söllinger
Georg Söllinger 2017 年 3 月 18 日
Thanks for your help! This attempt works. But actually, it is not yet 100% satisfying, as all values below 0.5 and above 1 are now displayed white instead of blue and red respectively. Any solution therefore?
Star Strider
Star Strider 2017 年 3 月 18 日
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’

サインインしてコメントする。

その他の回答 (1 件)

Georg Söllinger
Georg Söllinger 2017 年 4 月 9 日
Hi again,
I still have difficulties in defining the Interval. I have attached you the code and the raw data of my plot. The problem is, that if I exclude the Interval (especially for the Total Temperature Plot (4)), the plot is getting really fancy and I cannot find / solve the problem.
Help is really appreciated!! Thanks a lot in advance! Georg

カテゴリ

Help Center および File ExchangeData Distribution Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by