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
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
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
  3 个评论
Dipak Dulal
Dipak Dulal 2021-11-29
Did you download the file usastatehi.shp from the link you sent. I could not find the exact map file to plot. Your little bit more elaboration means a lot to me.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Biological and Health Sciences 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by