scaleLinear:
The scaleLinear function utilizes the domain, which for linear functions is the max/min of the dataset. To find this, I wrote "extent(pctMale) but you can also add n the max and min manually. The input is this extent, with the output being the visual representation of the data on a continuous scale, with white represented as min and max represented as dark blue.
To start this assignment, fork your last assignment (or profs second assignment) by pressing the three dots in the upper right corner. Create this assignment and give it a new name
Change the csv data output to focus on your normalized variable. For this assignment we will normalize a variable based on the percentage of men per county. To do this, I pulled the variables Total population (TOTAL_POP) and total men in a county (TOTAL_MALE). This then turns to a equation of Total men/total population
Create a normalized variable.
Our normalized variable will be named pctMALE to represent the percentage of men per county. We do this from combining the earlier information and defining it as pctMALE. We will use this variable for the rest of our lab.
Here we have a histogram made from the resulting information. This was forked from professors assignment. I put our newly created normalized variable "pctMale" after "x" to have that variable tested.
Histogram Analysis:
This histogram shows minimum values around 48% and maximum values around 52%. It shows most of the values are matched around the 50% zone (which makes sense for a gender distribution). The scale is relatively symmetrical with not much variation and no outliers for this dataset. The histogram allows for visual analysis of the entire dataset to allow for classification analysis.
Classification Analysis: (Description of individual classification schemes can be found later in this lab)
For this histogram, I would choose the quantile classification scheme since it ensures that each of my classes will have counties in it and allows for my small dataset to have visual changes.
Why not Natural Breaks?
I wouldn't choose natural breaks personally, just because my dataset is really small and there aren't a lot of bigger clusters.
Why not Quantize (Equal Interval)?
I wouldn't choose this one for similar reasons, but also since it may produce an inaccurate representation of my data.
This linear scale is functional because it allows for easy analysis of our numerical values through a color scale. The white is referencing our minimum values, slowly growing to our maximum values.
How did I figure out these colors?
- To get these colors, go to ColorBrewer2. This will show you different variables to choose from. You can choose any appropriate color, but for a continuous class, I'd recommend a single hue scale. You can also do this by writing "white" and "blue" in those spaces. For consistency, I chose specific codes.
Why did I choose these colors?
- Throughout this lab, I utilize colors on the blue/cool colored scale. I chose this because it allows for easy representation of my data visually through a gradually changing color. This section uses a single hue, meaning it moves along the color scale of blue.
Range Function:
- The value to color range is continuous to represent how this is a continuous scale.
Quantile Classification is when each class will contain the same number of features. This works well for the data we have presented since it is well-suited for a linear distribution. Each class has a number of data values for each class.
Issues with this:
Sometimes this can lead to information that is misleading. Features with very different values can be put in the same class. To minimize distortion between classes, you need to increase the number of classes.
How do I choose a class number?
- For my report, I chose only four classes due to the size of my testing group and the small difference between my max and min values. I chose to follow the square root rule, which is that the square root of n is your class. For me, n = 20, meaning my square root was about 4.5. I decided on four classes to show the variation in a small dataset with similar values.
https://statisticsbypeter.blogspot.com/2014/05/appendix-number-of-classes.html
Passing of data for scaleQuantile:
Input for your scaleQuantile is your entire dataset. The output is the colors that result from your chosen classes and colorscale. The scaleQuantile compiles this information using the doman(pctMale) with your given range to produce your output.
What is the domain?
The quantile domain is different because it doesn't use the max and min of the data; instead, it represents the entire dataset. It divides the data into equally sized groups.
Equal Interval Classification:
The equal interval classification allows for dividing the attributes into equal-sized ranges. Since there are four classes, the range within the numbers will be equal. This feature is called Quantize for this function.
Note: d3.extent pulls my min and max values easily. This is needed for my equal interval classifications. This is useful for multiple features. I pulled this up just to know my max and min for future reference.
What is the domain?
This is the max and min of our datasets. We wrote it as "min.(pctMale)" but it also can be written as ".4875" since this is the minimum we determined in an earlier cell.
What is scaleQuantize?
This is the min and max of our datasets to create an output of classes with equal interval widths. Since our range is 4 classes, there will be an equal division between each class.
The input of this data is the minimum values of pctMale and the maximum values of pctMale. The output is the visible representation of these values classified in an equal interval scheme.
How to use the hex code:
1. Go to Colorbrewer2 website!
2. Look for an appropriate classification for your code (4 classes)
3. Look for a color scheme that's fitting for you and copy and paste the code in here
Jenks Natural Break Classification:
This classification system is based on how the data might naturally group within the dataset. This can help maximize the differences between classes.
What is scaleThreshold?
- The scaleThreshold contains the data for the naturalbreaks and the domain. The domain is not the max/min or full extent of the data. Instead, the domain is the breakpoints in the data for each class which is derived from the natural breaks line and the pctMale.
The input of this domain is the natural breaks manual classification, and the output is the visual variables shown below.
Colors:
The data will be classified into the 4 classes. The visual variables will match the breaks.
This graph shows the data for each class! You can see the difference between this and linear (continuous) because you can clearly see the class breaks due to the color change.
Threshold is used for both manual and natural breaks. Threshold means breaks.
Manual breaks:
- This is defining your own classes or manually adding in your own class breaks. This can be done to create an appropriate break in your data.
Domain:
Domain/input will be the manual breaks. For this lab the breaks will be () because...
What is the manual interval:
- This is where you define your own classes and manually add class breaks to ranges appropriate to the data.