There are times when color selection can be challenging, especially when you are creating graphs or representign data. Because color can grab, as well as distract, people’s attention and influence perception, it is absolutely necessary to choose appropriate colors.
Black, for example, is often associated with mystery, death, and gravity. On the other hand, yellow is associated with energy and brightness. Different shades of a single primary color can represent different meanings and emotions.
How about the compositions of the color? Two or more colors together tell a vastly different story and have a signficant influence on one another. They can be complimentary, or work in juxtaposition.

There are many application of color theory, but on this blog post, we will focusing on the data visualization. Of all the design elemetns in a given visualization of the data- the headings, x and y- axis, etc- color selection and composition is definitely one of the most important components. When you are creating a graph, you have to think of different elments, including the context of the visualizaiton, and the presentation. Within thsoe myriads of concerns, there comes many question regarding color and color composition: how many colors you should use? What kind of colors should you use? How about the lightness and saturation of those graphs? To answer all the questions, I built a Non-deterministic Finite State Automata (NFA) that will provide solution to your dilemma.
We will be discussing how to utilize color in data visualization depending on different factors like the background of the image, number of variables in the data, type of data, etc.

The first category I chose is the Lightness and Saturation category, where it focuses on how bright/dull the color will be. Low scales lightness indicates the color is lighter, and the high scale of the saturation indicates that the color is closer to the purest and brightest form of the orignal color. I combined Lightness and Saturation instead of making a separate category with different states because . Individual states are indicated with the scale of 0-100 that corresponds to the lightness and staturation. The transition of this NFA is mainly the lightness and saturation of the background. It is absolutely necessary choose your lightness and saturation depending on the darkness or lightness of the background because you always want the background and the foreground to contrast. That way, the reader’s attention will be focused onto the graph itself rather than the blend of background and foreground.

The second category is the Composition of the colors. By composition, I mean the number of colors used and the relationship between the colors utilized. Many of the transitions will be determined by the nature of the data or the components of the data that the creater wants to emphasize. From the starting state, you first determine the number of variables that you want to emphasize. Then, you will transition into the states with the number of colors that you should use. As I do not recommend having more than 3 variables of interest, the 3+ state will be a non-accepting state.
From the 1 color state, you will look at the one variable that you want to highlight and determine whether the data is discrete or continuous. If it is discrete, you will loop back to the 1 color solid state and accept the condition, which will result in a simple 1-colored graph.

However, if the variable is continuous, you will move to the next state, where it will use one color but continuous color blocks to represent the degree and scale of the variable they wanted to emphasize initially. The graph below is a good example of such.
If you only one to highlight variable, or component, from the many, the machine will move its state to the 2-color contrast state, where they will use two different constrasting colors to highlight the variable of interest.

Similar to how we walked through individual states for 1 colored graph, we can apply similar thought process to 2 and 3 colored graphs. The complete NFA of the color utilization for data visualization will be the union of the NFAs discussed above as NFA are closed under union. We can add more complexity by adding more categories and increasing the number of states. However, the NFAs discussed in the blog post will definitely help you create a graph that will best represent your interest.