MATLAB Limiting Map Boundaries in Matlab for Scientists

  • Thread starter Thread starter Frank Einstein
  • Start date Start date
  • Tags Tags
    Map Matlab
Click For Summary
The user is trying to limit the display of a world map in MATLAB to a specific region defined by their data, which spans from 70N to 40S and from 45E to 125W. They initially sought a way to crop the map without using external tools like paint. After sharing their code, they received suggestions to utilize the axesm function, but found it ineffective for their plotting method. Ultimately, they discovered that using the axis function instead of axesm successfully achieved the desired result. This discussion highlights the importance of code sharing for effective troubleshooting in MATLAB.
Frank Einstein
Messages
166
Reaction score
1
Hello everyone. I have generated a world map by plotting coastlat and coastlon. I have done it because I want to plot some data that I have over said map. The problem is that my data goes only from 70N to 40 S and from 45E to 125W, thanks to that, I have a figure which looks like in the adjoint image (made with token data instead of the actual one).

Is there a way to limit the map to the colored area or do I have to manually crop it with paint?

Thanks for your answers.
mapa1.png
 
Last edited by a moderator:
Physics news on Phys.org
How are we to help you if you don’t show us your code?
 
Orodruin said:
How are we to help you if you don’t show us your code?
My code is as follows:
Matlab:
    figure
    contourf(Y,X, proxy_data_1)
    hold on
    axesm mercator;
    plot(coastlon,coastlat,'k','LineWidth',2)
<Moderator's note: code tags added. Please use them.>

While X and Y are defined as: [X,Y] = meshgrid(70:-0.25:-40,-125:0.25:45);

Proxy data is a matrix of size X*Y.
 
Last edited by a moderator:
Did you look up the help for the axesm function?
 
  • Like
Likes Frank Einstein
I am afraid it doesn't work since i am workng with plot instead of plotm; however, you gave me an idea, I have tried to use axis instead of axesm and it does the job. Thank you very much.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 12 ·
Replies
12
Views
4K
  • · Replies 1 ·
Replies
1
Views
7K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
5K
  • · Replies 11 ·
Replies
11
Views
4K
  • · Replies 4 ·
Replies
4
Views
3K