How to avoid white patch in contourf ?

35 ビュー (過去 30 日間)
DIPANJAN DEY
DIPANJAN DEY 2018 年 3 月 23 日
コメント済み: Kelly Kearney 2018 年 3 月 26 日
I am facing a problem from quite a long time. My data range is beyond my colorbar limit. That is why when the minimum value exceeded the colorbar limit it is coming white but it is okay for maximum value. How to solve this? In python something like extend = both works but what about MATLAB?
PS: I don't want to extend my colorbar limit.
  8 件のコメント
Image Analyst
Image Analyst 2018 年 3 月 23 日
You say "when the minimum value exceeded the colorbar limit it is coming white" however, the minimum value (according to the colors) seems to be -1.9. However not all values that exceed your minimum value are white. I see values showing up as red and blue also. In fact, it seems like the only values showing up as white are around the range -0.1 to +0.1.
Anyway, let's assume you want that range to be some color other than white. You can just set the middle of the colormap to that color. What color do you want it to be?
DIPANJAN DEY
DIPANJAN DEY 2018 年 3 月 23 日
The middle portion of my colorbar is white due to my colormap. But the white portion in the middle of the figure is not due to the colormap and the values there are lower than -1.9. If you use a different colormap then also you can see this white region.

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

回答 (1 件)

Kelly Kearney
Kelly Kearney 2018 年 3 月 23 日
Matlab's contourf function doesn't actually plot contour faces for lower-than-lowest-clevel regions when are unenclosed. (And for that matter, what it does with enclosed lower-than-lowest-clevel regions varies between Matlab versions).
I think my contourfcmap function with the calccontour option should be able to create the plot the way you'd like it.
Alternatively, you can set your axis color to match the lowest value in your colormap... that way empty contour regions will appear the correct color.
  4 件のコメント
DIPANJAN DEY
DIPANJAN DEY 2018 年 3 月 23 日
編集済み: DIPANJAN DEY 2018 年 3 月 23 日
Thanks for your help. Yes this is the plot I want it but now the x_axis reduces as we omitted the nans, also if we increase the x-axis there is straight line coming at the end. Which is in my case not acceptable. Another thing, now i am unable to move the colorbar to my desired location (other than specified). Data cursor also not showing the value, i cannot specify my line style
Kelly Kearney
Kelly Kearney 2018 年 3 月 26 日
I'm working on a fix to the NaN issue... may take a day or two. The colorbar enhancement is one that's been on my to-do list for a while... I'll see if I have time for that one as well, but no promises.
You can specify the line style by saving the handles structure (first output of contourfcmap) and then applying any changes you'd like.
Not sure about the data cursor thing... I don't use that myself. If it relies on interacting with a contourgroup object, then that's not really something I can offer, since my function uses simple patches and lines.

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

カテゴリ

Help Center および File ExchangeColormaps についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by