2D plot of a matrix using colors

2 views (last 30 days)
I would like to plot air pollutants emissiosn on the US map.
The datasets I am using are
  • lat.mat (172*172)....latitude data
  • lon.mat(172*172)...longitude data
  • CH4.mat (172*172)...air pollutant emission data[mol/sec]
load 'latmat.mat';
load 'lonmat.mat';
load 'CH4.mat';
figure; ax=usamap(('NY','FL'));
setm(ax,'FFaceColor', [.5 .7 .9]);
title('Air pollution map');
%Read shapefile of US with names and locations
states=geoshape(shaperead('usastatehi.shp','UseGeoCoords',true));
%Display map
geoshow(states,'Parent',ax);
%Find states within the shown axes limits
latlim=getm(ax, 'MapLatLimit');
lonlim=getm(ax, 'MapLonLimit');
idx=ingeoquad(states.LabelLat, states.LabelLon,latlim,lonlim);
%Plot coordinates
txt=states(idx).Name;
linem(latmat,lonmat,'LineStyle','none','LineWidth',2,'Color','r','Marker','o', 'MakerSize',10);
This coding results in the figure below(Left). This is obviously 2-D data map.
However I would like to consider the values of air pollutant(z-factor).
The ideal image is like this.
Is there any way to model the dataset?

Accepted Answer

Cris LaPierre
Cris LaPierre on 6 Mar 2019
There is a challenge here. If you just plot all of CH4emission1 you will just get a block that covers up the map. If you want to see dots, you will need to pick a threshold and only show air polution greater than it. Conversely, you could recolor the map. You have a couple options.
To add something that will work with your script, here is a way to use scatterm to create markers. I've thresholded the pollution data so that only values >5 are shown. The problem here is that, being a scatter plot, the markers are given a size (5), so the points may be artifically big.
idx = find(CH4emission1>5);
scatterm(latmat(idx),lonmat(idx),5,CH4emission1(idx))
colorbar
If you are willing to change things a bit, my approach would be to show all the air pollution data and overlay an outline of the states to that. It just depends what you need. Here's a possible solution
figure
latlim = [min(latmat(:)) max(latmat(:))]
lonlim = [min(lonmat(:)) max(lonmat(:))]
ax = usamap(latlim, lonlim);
title('Air pollution map');
surfm(latmat, lonmat, CH4emission1)
states = shaperead('usastatehi',...
'UseGeoCoords',true,'BoundingBox',[lonlim',latlim']);
geoshow(ax,states,'FaceColor','none')
contourcbar
Here is the resulting image
Chihiro_Omori_map.png

More Answers (0)

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!