フィルターのクリア

Removing lines in scatter plot when using shading interp

6 ビュー (過去 30 日間)
Ashley
Ashley 2012 年 7 月 12 日
I'm using scatter and pcolor in the same axis but on different data. When I run shading interp on the pcolor plot, colored lines are plotted connecting all the scatter points on the other data. Here is an example:
[X,Y,Z] = peaks(30);
scatter(X(:),Y(:),20,Z(:),'filled')
shading interp
Does anyone know a way to get rid of those lines? while still preserving the way pcolor looks in the same axis?
Thanks
Ashley
  1 件のコメント
Walter Roberson
Walter Roberson 2012 年 7 月 12 日
Sorry, I do not see the pcolor()? pcolor() is a routine to create pseudo-color plots; you do not appear to have invoked it. pcolor() is not at all the same as shading interp.

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

回答 (2 件)

Kelly Kearney
Kelly Kearney 2012 年 7 月 12 日
The shading command affects all surface and patch objects, including the child patch object that's part of a scattergroup object. You can manually set the edge color of that patch back to it's default value:
[X,Y,Z] = peaks(30);
pcolor(X,Y,Z+10);
hold on
hs = scatter(X(:),Y(:),20,Z(:),'filled');
shading interp;
set(get(hs,'children'), 'edgecolor', 'none')

Ashley
Ashley 2012 年 7 月 12 日
Thanks! that worked!

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by