The first line of code creates an unclassed map. Then creates a chart with no classification. Then the second line you take into account the minimum and maximum into the domain. This takes into account the range. Then the last line with .range, you can set the colors with the output below. So the white is minimum and green is the maximum of the domain.
To choose the colors, go to the colorbrewer and you can see different scales of colors and then there are certain codes for colors. I am using the same color, but different values of the color.
While doing all of this, you need to make sure you keep using the same variable name so your code can work. For example, the data I am using is called "death_pct" and I keep using that in the rest of my code or else it will not know what you are talking about and no data to work with. This line of code is hard to read and it is hard to tell the difference in colors.
With this line of code and function with natural breaks. All you need to do it input your data and then select how many breaks you want to have. In this case I want 3 breaks and it outputs that above the cell with the actual numbers. Then since we assign natural breaks to this array, we can input that into the cell below where we used to put the min and max for the domain. That is the difference between unlcassed and natural breaks.
Natural Breaks produces the best classification in my opinion since it makes the breaks in the most logical ways with statistics. Then the colors are appropriate as well at least in the plot below. We will see and it could change when we make the map in the next assignment.
This makes the plot of the histogram. It takes in the data with "csv_data_objects" and then plots it. It takes the count and then plots it on a x and y axis.
I need to make this better, and I believe we will learn how to make it look better in another assignment. The distribution does not look good because of the counties with 100% death rate. This is very unusual because this data is from when the pandemic first started so there was not a lot of data. So once I can make this look better or even take out the 100%'s it will be a much better distributed graph.
This chunk of code makes an array made of objects for plotting the array. So it takes the FIPS and then my normalized variable. It is a lot like the previous but makes it a little more organized for the plotting next.
Equal interval takes the min and max of the data and then splits it evenly based on how many classes you want based on how many colors you have in the visual part. So if I wanted more than 3 classes then I would put in another color. Then the visual variables are below just like the other blocks of code.
When doing threshold, you are manually selecting the breaks in your data. If you want 2 breaks then you should have 3 colors (classes). So you should always have 1 more color than breaks you have in the "domain" line of the code. My data is mostly close to 0 so I wanted to choose some smaller number so there can be classes that are more evenly distributed.