Question

In: Computer Science

How do I create a choropleth map of the United States where there are two maps....

How do I create a choropleth map of the United States where there are two maps. One that shows the states and one that shows the counties, in PYTHON, from the beginning. When I hover a state or county the border should be highlighted and the name of the state/county displayed. I would like to use Plotly and the covid-19 dataset that I have. It contains latitude and longitude coordinates for each state or county.

Solutions

Expert Solution

Answer :

How do I create a choropleth map of the United States where there are two maps. One that shows the states and one that shows the counties, in Rstudio, from the beginning. When I hover a state or county the border should be highlighted and the name of the state/county displayed.  

I need to do this so that I can display the COVID-19 data that I have.


library(ggplot2)
library(scales)
library(ggmap)
library(viridis)
dataset$id <- rownames("dataset")
newUS <- fortify(US3, region = "id")
newdf <- merge(newUS, US3@data, by = "id")
Myplot <- ggplot() +

geom_polygon(data = newdf, aes(fill = Bush_pct,
x = long,
y = lat,
group = group)) +
theme_nothing(legend = TRUE) + coord_map() + ggtitle("column_name") + theme(plot.title = element_text(hjust =0.5))

NicerPlot <- Myplot + scale_fill_viridis(option = "magma", direction = -1)
NicerPlot

I hope this answer is helpful to you, please upvote my answer. I'm in need of it.. Thank you..


Related Solutions

How do I create a choropleth map of the United States where there are two maps....
How do I create a choropleth map of the United States where there are two maps. One that shows the states and one that shows the counties, in Rstudio, from the beginning. When I hover a state or county the border should be highlighted and the name of the state/county displayed.   I need to do this so that I can display the COVID-19 data that I have.
Prove that the composition of two quotient maps is a quotient map.
Prove that the composition of two quotient maps is a quotient map.
How do I create an experiment to: 1. Confirm that there are two types of charge...
How do I create an experiment to: 1. Confirm that there are two types of charge 2. Develop a method to test Coulomb’s law 3. Explore the three main methods for charging objects
Please answer the following: How do the economic systems of Russia, the United States, the United...
Please answer the following: How do the economic systems of Russia, the United States, the United Kingdom vary? How do political policies, property rights, and public choice system in Russia, the United States, the United Kingdom relate or differ? Any help is appreciated, I always give a thumbs up too, thank you!
How would I create a program in C++ where you build and maintain two binary search...
How would I create a program in C++ where you build and maintain two binary search trees of information? I have already created the file reader which I will list on the end. The 2 binary search trees should be controlled by the Operations: L -- for launching a satellite, which will save it's info to the first set or D -- for deorbit the satellite. The other operations I'm looking to implement are: F -- for find, where user...
How do you think we should change how we do elections in the United States to...
How do you think we should change how we do elections in the United States to increase participation? Are traditionally low voter turnouts a problem for our democracy? Should everyone vote, or be allowed to vote?
I am supposed to map out the following and can't figure out how to do it!...
I am supposed to map out the following and can't figure out how to do it! Can somebody help? The experiment has to do with determining the simplest formula of potassium chlorate and to determine the original amount of potassium chlorate in a potassium chlorate-potassium chloride mixture by measuring the oxygen lost from decomposition. The chemical reaction is 2KClO3(s) ------> 2KCL(s) + 3 O2(g) I am supposed to map out 1. Mass of oxygen lost in the first part 2....
Suppose that the United States and Canada can each produce two products: lumber and beef. Create...
Suppose that the United States and Canada can each produce two products: lumber and beef. Create a table like the one below, showing labor requirements per unit of output for each country. (Hint: Choose numbers for each country that are easily divisible by one another.) Labor Requirements per Unit of Output United States Canada Lumber Beef What does absolute advantage mean? How do you calculate absolute advantage? In what output(s) does the U.S. have an absolute advantage? Explain using the...
Suppose that the United States and Canada can each produce two products: lumber and beef. Create...
Suppose that the United States and Canada can each produce two products: lumber and beef. Create a table like the one below, showing labor requirements per unit of output for each country. (Hint: Choose numbers for each country that are easily divisible by one another.) Labor Requirements per Unit of Output United States Canada Lumber Beef What does absolute advantage mean? How do you calculate absolute advantage? In what output(s) does the U.S. have an absolute advantage? Explain using the...
The Cheesecake Factory Incorporated​ (NASDAQ: CAKE​) operates two bakeries in the United States where it makes...
The Cheesecake Factory Incorporated​ (NASDAQ: CAKE​) operates two bakeries in the United States where it makes over 70 desserts for its own restaurants. In​ addition, the Cheesecake Factory bakeries sell selected desserts to a variety of foodservice operators and​ retailers, including Sam's Club​, Walmart​, Target​, BJ's Wholesale Club​, and Barnes & Noble Cafés. The Cheesecake Factory has accounts receivable on its financial statements. The primary source of its accounts receivable is its sales to bakery customers. ** There is no...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT