How can I plot values in worldmap

17 views (last 30 days)
Elizabeth on 11 Jun 2013
Hi. I am new to matlab and I want to plot different values in the arctic region.
I have a set of longitudinal and latitudinal degrees and valuees for each point. I want to plot the ice concentration in the arctic, and have several points with information. But how to plot it?
I get to se the north pole and the coast lines, but how to go from there to get a map with all the information in it?
( I could not find a region called arctic either, so I chose North Pole ) * worldmap('North Pole')
load coast
This is all I have.
Hope to get some help here,

Answers (3)

Angus on 11 Jun 2013
you can check out axesm and try executing "maps" to see a list of available projections and IDs to use with axesm. Depending on the format of your data you should be able to find a projection that works well (maybe the universal polar stereographic).
load coast
axesm('ups')% include other axesm options as needed to define lat lon range
framem on;
axis off; % Turns off surrounding box
pcolorm(latd,lond,mapdata) % pseudocolor plot "stretched" to the grid
geoshow(lat,long,'Color','k') %add continental outlines
lat and long are from the 'load coast', latd and lond are 2d matrices of the same dimensions as mapdata.
Unfortunately I havn't worked with the worldmap function so I dont know the options there.
Best luck, Angus
Angus on 12 Jun 2013
I dont think geoshow is what you will want to use to display your actual data, it works well for drawing out the coastlines though.
If you haven't yet tried pcolorm give it a go and see what you think, but if contours are what you are after then contourm(lat,lon,ice) or contourfm(...) for filled contours are good options to look into.

Sign in to comment.

Chad Greene
Chad Greene on 12 Jun 2013
Here are a couple of suggestions:
2. Plot values with scatterm or pcolorm. If you use pcolorm, by default it sometimes includes a grid which can obscure your data. Get around this by following it up with shading interp or one of the other shading commands.
Hope this helps.
Rob Comer
Rob Comer on 16 Jun 2013
What you saw was actually one error, but one error very far down the call stack. Functions like pcolorm (and surfacem, which is right below it in this case) try to validate their input and throw helpful errors if it's not correct. But your input seemed to pass the validation in surfacem and then get into trouble much later (way down the stack). If you can send me LAT, LON, and CT, then I can investigate. Or open a support case with MathWorks Technical Support: and ask them to escalate it to Development.
-- Rob

Sign in to comment.

Angus on 17 Jun 2013
From your previous comments:
"The LAT and LON matrix will vary for each week I pull out information from my database. And I will have one CT ( concentration) value for each column in the LAT and LON matrices."
This seems like it will be hard to deal with no matter what plotting method you choose.
If you have access to the algorithm that pulls the information I would start with changing that; instead of ordering by CT values just pull a grid box area and fill any missing values with NaNs.
If not then I would aim to convert the matrices and arrays that you have before trying to plot them. Here are some ideas for the steps to take, if this seems like a reasonable approach then I can help as you go through it.
- find weekly range of lat and lon (max/min)
- construct a 2D grid (meshgrid) for lat and lon according to your range and resolution.
- create a 2D NaN matrix with dimensions of your lat/lon matrices.
- pull CT values from your array and insert them in your NaN matrix at the correct lat/lon.
- use pcolorm(lat,lon,CT) with your new matrices. (or contourm)
Cheers, Angus.

Community Treasure Hunt

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

Start Hunting!