Unwanted lines show up on surface plots

52 ビュー (過去 30 日間)
Al
Al 2018 年 12 月 26 日
コメント済み: Walter Roberson 2018 年 12 月 27 日
See image below. Can anyone help me understand why the extra line shows up on the surface plot?
At first I thought it was a calulated point, however, it is not selectable with the data curser to determine the coordinates.
How can I get rid of these lines?
image.png
  5 件のコメント
Al
Al 2018 年 12 月 26 日
yes. i intentiomally have nan in the data to exclude certain solutions from being plotted.
i have if statements. if certain varibles are outside the constraints, then those get marked as nan so they are excluded from the plot and data output.
is there a way to continue to use the nan’s and get rid of the extra lines?
Walter Roberson
Walter Roberson 2018 年 12 月 26 日
The dark lines are from the default 'edgecolor' 'Black' that surf uses. You can get rid of them by passing edgecolor none .
If you want the dark lines but not the apparent spike then you should probably investigate patch() and the various ways it has of specifying edge colour .
surf interpolates face color from four adjacent vertices. If any of the four is nan then the face is nan. But if you have two adjacent non-nan vertices then edge can be drawn between them. If they are surrounded by nan then no face will be drawn leading to edges drawn with no face.

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

回答 (1 件)

Image Analyst
Image Analyst 2018 年 12 月 26 日
When you call surf() set 'edgelines' to 'none'
surf(x, y, z, 'EdgeLines', 'none');
  4 件のコメント
Image Analyst
Image Analyst 2018 年 12 月 26 日
Right EdgeColor.
Seems like you don't want to set that to none if you like the lines. Looks like you just need to set an additional nan somewhere if you want to get rid of that isolated spike to nowhere. Of course that will be a very, very specific ad hoc fix just for that particular data set.
Walter Roberson
Walter Roberson 2018 年 12 月 27 日
You might be able to use
zt = z;
zt(imclose(isnan(zt),ones(2,2))) = nan;
surf(x, y, zt, 'edgecolor', 'none')
except that this might not adjust the four corners correctly.

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

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

製品


リリース

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by