Effacer les filtres
Effacer les filtres

Contour plot - how to show contours of irregular body in XY plane?

7 vues (au cours des 30 derniers jours)
Janez
Janez le 12 Avr 2013
Hi all
I use contour(X,Y,Z,n) function and it works fine. However, sometimes I would like to show only one part of the contours which are in top view (X-Y plane) within body of irregular shape. Something similar like "inpolygon".
Is anybody having an idea how to show only contours within selected area?
Thanks, Janez

Réponse acceptée

Sean de Wolski
Sean de Wolski le 12 Avr 2013
You could replace the values that you don't want with NaNs. For example:
[x,y,z] = peaks;
subplot(121)
contourf(x,y,z)
z(abs(z)<0.5) = nan;
subplot(122)
contourf(x,y,z)
  1 commentaire
Janez
Janez le 15 Avr 2013
Thank you, it works. I love simple solutions ...

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Contour Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by