To usa counties and state mape and shade with different color
16 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Dipak Dulal
el 29 de Nov. de 2021
Comentada: Dipak Dulal
el 29 de Nov. de 2021
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 comentario
Star Strider
el 29 de Nov. de 2021
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.
Respuesta aceptada
Chunru
el 29 de Nov. de 2021
Editada: Chunru
el 29 de Nov. de 2021
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
Más respuestas (0)
Ver también
Categorías
Más información sobre Biological and Health Sciences en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!