Outline of shape in matrix using contour?

3 Ansichten (letzte 30 Tage)
Michelle De Luna
Michelle De Luna am 13 Nov. 2020
Kommentiert: Star Strider am 16 Nov. 2020
Hi all!
I have a matrix with various shapes. The matrix looks something like this (picture included below) when I use the imshow command. I was wondering if anyone knew how to outline the shapes so that only the outline of the shape (i.e. the boundaries) appears. I tried using contourf, and it works, but this flips the image upside down. Any other options?
I have included some code for reference:
shape = ncread(file, 'shape', [1,1,1,612,1], [inf, inf, inf, 1, inf])
imshow(shape)
contourf(shape)
Thanks in advance!

Akzeptierte Antwort

Star Strider
Star Strider am 13 Nov. 2020
Try this:
figure
contourf(shape)
set(gca, 'YDir','reverse')
axis('equal')
That should fiip it right-side-up.
  2 Kommentare
Michelle De Luna
Michelle De Luna am 15 Nov. 2020
@Star Strider: This is exactly what I was hoping for! You're the best. Thank you very much! Please stay safe and take care. :)
Star Strider
Star Strider am 16 Nov. 2020
As always, my pleasure!
I very much appreciate your compliment! You, too!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Contour Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by