I'm trying to bring m_gshhs_f(....) in front of my plot.

I want to represent my study areas (delimited by boxes) using m_plot and the coastline as a patch using m_gshhs_f. Each box includes a region of land and sea. My goal is to represent the boxes under the line coast in order to see only the 'in sea' part.
I have tried to switch the order in the code.
I have tried to download the coordinates of the coastline and to plot it with m_usercoast. But each time I try to represent it with a 'patch' style, the problem persists...
I have tried to create a polygon from the coastline data and to ''erase" the sections of the boxes that are not inside the polygon but the result is too unaccurate.
Please tell me you have any ideas. I am certain there is a way

Antworten (1)

Adam Danz
Adam Danz am 4 Mai 2025
Bearbeitet: Adam Danz am 4 Mai 2025

0 Stimmen

These files belong to a 3rd party toolbox which I found here: https://kml.deltares.nl/docs/OpenEarthHtmlDocs/blue/applications/m_map/m_gshhs_f.html
I'm not familiar with this product but it sounds like you're trying to control stacking order. If you have handles to the graphics objects, try using uistack to control their stacking order. This may not solve the problem and it may introduce other problems but that's where I would start without knowing more information.
You may also want to consider using MATLAB's Mapping Toolbox instead, if you have access to it.

1 Kommentar

In the end, I managed to solve it. After having written M_gshhs(..) at the end of my script, I added the command set(gca, 'SortMethod', 'childorder') and it worked perfectly. It's possible that the option you suggested of using the MATLAB Mapping Toolbox would have worked, but I didn't try it. Thanks!

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Vector Fields finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 30 Apr. 2025

Kommentiert:

am 8 Mai 2025

Community Treasure Hunt

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

Start Hunting!

Translated by