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

4 views (last 30 days)
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

Answers (1)

Adam Danz
Adam Danz on 4 May 2025
Edited: Adam Danz on 4 May 2025
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 Comment
CHARLOTTE
CHARLOTTE on 8 May 2025
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!

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!