Filter löschen
Filter löschen

Removing white space on pcolorm plots (for irregular rotated mesh)

2 Ansichten (letzte 30 Tage)
Darcy Cordell
Darcy Cordell am 14 Aug. 2023
Beantwortet: Karan Singh am 29 Aug. 2023
To summarize, the mapping toolbox in MATLAB for some reason clips any data that intersects the map frame. This means that maps which use pcolorm will not plot patches that intersect the map frame and leave white space instead. The answer to the above linked question suggests to set the map limits carefully to avoid patches intersecting the map frame and thus avoid white space.
Not only is this solution somewhat frustrating and tedious, but it also only works for meshes aligned with the map. In my case, I have an irregular mesh which is rotated with respect to the map axes resulting in this:
In this case, there's no way to set the axis limits to avoid this ugliness. I'm not sure if there is a simple solution to avoid the ugly white space at the edges. More broadly, I don't understand why the mapping toolbox clips the data like this in the first place. Seems like a bug to be fixed rather than any sort of useful feature...
Any info is appreciated.
Thanks

Antworten (1)

Karan Singh
Karan Singh am 29 Aug. 2023
Hi Darcy, Unfortunately, the behaviour you described is a limitation of the toolbox as I believe, and there isn't a straightforward solution within the toolbox to avoid the white space when plotting irregular meshes that intersect the map frame.
In cases where you have an irregular mesh that is rotated with respect to the map axes, you may need to consider alternative approaches or custom solutions to achieve the desired visualization. One option could be to manually plot the irregular mesh using lower-level plotting functions, such as “patch” or “surf”, and carefully align it with the map axes using coordinate transformations.
Use the “geoshow function: Instead of using “pcolorm, you can try using the “geoshow” function from the Mapping Toolbox. “geoshow” is specifically designed for displaying georeferenced data and can handle irregular meshes and rotated data more effectively. It provides more control over the display and can possibly help avoid the clipping issue you are experiencing.
If you could kindly provide the code, we can further investigate and experiment with different approaches to address the issue. I trust that the suggestions provided above have furnished you with the necessary information.

Community Treasure Hunt

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

Start Hunting!

Translated by