Applying different themes to data visualization with blender.
A key component in any data visualization is the colors used for the elements in the visualization. From the lines and dots to the data and axis labels, the colors used have a central role in the visualization. Color selection can change the perception of the data or emphasize a particular element in a data visualization. The following describes a simple and quick method to create a mock dashboard to select the right color and theme combination.
Mock data can be created in a variety of ways, it can be a fixed set of preselected numbers or random numbers. An advantage offered by random numbers is the variability and the different combination of data that can be created. That variability can be helpful to detect extreme data cases or particular problems with the visualization design. Particularly, NumPy offers a function to create random numbers in the range [0,1]. Using that functionality a set of three different mock data sets are created for a bar plot, a scatter plot, and a line plot.
The bar plot is created by adding a series of extruded cubes and a label at the bottom of each cube. All the added geometries are joined in two sets, a data set, that contains the bars and a tick set, that contains the label for each bar. Each group contains only one geometry object to simplify the number of objects in the scene.
While the line plot can be seen as a special case of a scatter plot where the consecutive points are connected by a line between them. Following the same logic as the bar plot, the scatter plot geometries are also grouped in data elements that consist of the dots in the plot, and the tick elements for the x and y-axis. And for the line plot adds the lines that connect the data as another data element.
With the visualization elements already defined and grouped into data and tick elements, the materials for those geometries can be added. To define the materials the nodes function offers flexibility to create, modify, and personalize the materials. The first material consists of three nodes, an input node that takes an RGBA value to specify the color. A simple Principled BSDF blender shader and the material output.
With this simple material definition, different colors can be added to the elements in the visualization. Rendering the visualization with different color combinations and with a white background results in the following.
Although the visualizations with the white background show the data properly, watching a white background for a long time can create discomfort for some people. Changing the withe background to a darker one can enhance the contrast between the data and the background. Also, emitting materials can be used to add glow in the visualization elements. Glowing materials can be defined in several ways in blender a simple way is to mix an emission node with a principled BSDF using a mix shader, the output of that node is connected to the material output.
Rendering data visualization with different combinations of glowing materials shows the following.
On each visualization, the elements can be recognized with ease and the glow is subtle enough to not interfere with the other elements in the visualization. As the glow attracts the attention to the elements in the visualization it can be turn off to emphasize an element.
Turning off the glow emphasizes a single element in the visualization, all the chart elements are visible, however, the glowing one shows up.
The previous shows a simple way to create a mock dashboard to test different themes in a data visualization as well as some basics on how to define a material in blender. The complete code for this post can be found in my GitHub by clicking here. See you in the next one.