This example forks the cars scatter plot with menus exercise and adds a menu for color coding. In this case some categories were too large to properly display a legend and meaningful colors (e.g. name). So I've limited the legend to categories with less than 12 different values.
If the category has more than 10 values and is a numeric ordinal value, I opted to display a color scale of 15 values from the bottom of the scale to the top. In this case, clicking on a single color value to filter the points is not useful. It would be better to provide a sliding filter. But for categories with less than 12 values, it's still a useful interaction.