Removing lines in scatter plot when using shading interp

2 visualizaciones (últimos 30 días)
Ashley
Ashley el 12 de Jul. de 2012
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 comentario
Walter Roberson
Walter Roberson el 12 de Jul. de 2012
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.

Iniciar sesión para comentar.

Respuestas (2)

Kelly Kearney
Kelly Kearney el 12 de Jul. de 2012
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 el 12 de Jul. de 2012
Thanks! that worked!

Categorías

Más información sobre Contour Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by