How can I plot values in worldmap

34 views (last 30 days)
Elizabeth
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
plotm(lat,long)*
This is all I have.
Hope to get some help here,
-Elizabeth

Answers (3)

Angus
Angus on 11 Jun 2013
Hi,
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
tightmap
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
  3 Comments
Elizabeth
Elizabeth on 12 Jun 2013
I found that using geoshow would help me abit. I get to plot the vector I am trying to plot, but not the corresponding value of the vector. In other words I get geoshow(LAT(1,:),LON(1,:),'marker','.','color','red')
I want to plot this area as a contour some how, and with a value to the contour ( a z value ) how can I do this?
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
Elizabeth:
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.
  4 Comments
Chad Greene
Chad Greene on 13 Jun 2013
Elizabeth,
It's strange that your sea ice concentration matrix data is a vector while your lats and longs are [m x n] matrices. In what format is your raw data? From the NSIDC it looks like their data comes in a form where the size of lat, long, and CT are all [m x n] matrices. For example, we can get an arbitrary month from here: <ftp://sidads.colorado.edu/pub/DATASETS/NOAA/G02202/north/monthly/> Then open it up in Matlab via
lat=ncread('seaice_conc_monthly_nh_f13_200308_v01r00.nc','latitude');
lon=ncread('seaice_conc_monthly_nh_f13_200308_v01r00.nc','longitude');
CT = ncread('seaice_conc_monthly_nh_f13_200308_v01r00.nc','seaice_conc_monthly_cdr');
Plotting this should be straightforward with pcolorm. I don't have the mapping toolbox on the computer I'm using today, but I can take another look at this tomorrow if you're still trying to get it to work then.
Rob Comer
Rob Comer on 16 Jun 2013
Elizabeth,
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: http://www.mathworks.com/support/contact_us/index.html and ask them to escalate it to Development.
-- Rob

Sign in to comment.


Angus
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.

Products

Community Treasure Hunt

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

Start Hunting!