Get startedGet started for free

Prepare the data for the visualization

1. Prepare the data for the visualization

Creating data visualizations in KNIME is fairly easy, but there are a few things to keep in mind. First of all, you need to make sure to plot the correct data type. This table contains the famous iris dataset, containing the petal and sepal dimensions of those flowers. Let’s try to plot two of those dimensions in a scatter plot to explore their relation. You can see that the resulting plot does not really make sense: the values in the axes are not sorted and this creates a misleading visualization. Having a quick glance at the input table, you realize that the columns contain string data instead of numbers. To fix that, you can use a converter node such as the String to Number node. After that, the node will be able to sort the input data and create a correct visualization. Sometimes the table is just not in the right shape. For example, to create a simple bar chart, you need categorical values in one column, and the numeric values in other columns, if you want to aggregate them for each category. The table in this example is not suited to be plotted in a bar chart, because it misses the categorical value. You can easily fix this with the Unpivot node. This visualization already tells us something, but we can make it even cleaner. For example, it would be more natural for the reader to see the bars ordered by the day of the week. The visualization nodes by default plot the data in the order that they appear in the input table. Therefore, let’s operate on that. In this case, it is simpler to sort the columns before unpivoting, using a Column Resorter node. Using other nodes such as the Sorter node is also a valid option. By default, some nodes such as the Bar Chart will group the data and assign a different color to the group. Although this can be useful, for simple visualizations, too many colors can distract the reader without adding more information. You can change this behavior in its configuration window. If instead you want to introduce color, make sure to be consistent with it. For example, make sure to use the same color for the same categorical value when it is displayed across different charts. In the previous example, we used the color manager to assign a color to each flower species. The node outputs a color model that can be connected to a Color Appender node. When a new table is passed to this node, you can select a column on which the same color model is applied. This will make sure that the colors are consistent through all your visualizations. Let’s practice those data preparation techniques in the next exercises.

2. Let's practice!