To build an unclassed scale, or continuous scale, in observable, you need to define the domain, which in my example is the extent of my bird density, which the formatting for is shown above. Make sure the d3 matches what is on the second line of code at the top of this page. Instead of using extent like I did for the domain, you can also use the max and the min. For the range, you can set colors that you want to use to display your data, and you only need two colors for this, because observable will create its own gradient between those numbers to show each individual data point.
To map classes to colors using scales, just make sure you're picking a color scheme that is a gradient of some sort so that classes are understandable and also follow a scale.
To implement classification in observable, you can literally just choose a classification! In my example, I am using quantile, equal interval, natural breaks, and manual, or threshold classifications. Again, just used domain as bird density, but for this, you don't need to define the extent of the domain, because it just uses all of the data points in my data. You also need a range, which is a set of colors that will show classes. For mine, I set it the classes as 'color', which I defined earlier as a set of nine colors.
For natural breaks, you first set the number of breaks you want to use in the equation that is equal to 'naturalbreaks', and because you are already pulling in the data from 'bird_density', you just use natural breaks as the domain in the second line that's set equal to jenks. In the same line, you again set a range equal to a set of colors that you chose.
Equal interval is very similar in creation, you just set your code equal to quantize, and for the domain you can you just set the min and max, and input your data in, which is again bird density for mine. Again, for the range, use your set of chosen colors!
Threshold is your manual classification! Again, you can just input your data into where I have bird_density and use the same code! This time, for the domain, you can manually set your own classes! I chose to use very small numbers for this, because a lot of my data includes very small numbers, and I felt like this would be a good way to show some of that! Again, you can pick your colors however you want, but make sure the amount of classes you picked aligns with the amount of colors you chose.
The number of classes you choose really depends on the on the classification that you are using. Linear only needs two always, quantile can be several, it is just up to you to see what represents the data the best, which is the same for the majority of them. I chose to have a bit of a higher number of classes for a lot of the options just because my data is so skewed, and I feel like having that illustrated can be helpful.
To use colors from color brewer, simply go to the website! You can choose the number of classes from the drop-down menu on the top, and pick between sequential, diverging, and qualitative. Qualitative is best when order doesn't matter between your data sets. Then you pick a color scheme! You can copy and paste the codes for the colors into observable, and create a name for you scheme. Set the codes equal to that name, and make sure there are quotation marks around each color code, and that they're separated by commas, and that they are with in square brackets! You can then call the name down in the classifications when setting the ranges!