To usa counties and state mape and shade with different color
16 次查看(过去 30 天)
显示 更早的评论
Hi,
I am working on a project and basically, I'm trying to import a map of US with counties in deffernet states marked on it. my purpose is to add data about each county, specifically about the concentration of spread of Covid cases.US. Then, I want to give each county a certain shade of color based on the concentration.
Does Matlab have a feature which can detect the counties on a map? if so, can each element (county) store data and be assigned individual colors?
I am experienced in Matlab and have coded a lot of numerical analysis projects before. This is a side project, and I've never worked with image importing and detection in Matlab, which is why I'm asking.
Thank You
1 个评论
Star Strider
2021-11-29
It will likely be necessary to use the Mapping Toolbox for this project, and specifically use Web Map Service. The U.S. CDC Covid Data Tracker should be able to provide the information, however it may require a bit of exploration to find the source of the data in a usable, numeric form that can be downloaded.
I do not have the Mapping Toolbox (my only experience with it is the online Run feature here) however I am certain others have extensive experience with it and will likely be able to help.
Post back here when it works satisfactorily, and consider uploading it to the File Exchange as well, since COVID is going to be with us for a few years. SARS-CoV-2 is an unstable virus, mutates readily, and so will circulate widely until a large enough fraction of the population has broad-based natural immunity to it to stop its spread.
采纳的回答
Chunru
2021-11-29
编辑:Chunru
2021-11-29
warning off
states = shaperead( 'usastatehi.shp'); % MATALB comes with usa states map .shp file
You can download the county level map from:
% Extract the polygons in the .shp file
struct2poly = @(s) polyshape(s.X, s.Y);
p = arrayfun(struct2poly, states);
plot(p)
% to specify the color for each state
figure; hold on
plot(p(1), 'FaceColor', 'r');
plot(p(2), 'FaceColor', 'g');
plot(p(3), 'FaceColor', 'b'); % and so on
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Biological and Health Sciences 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!