Creating a matrix

Calculate relationships between two sets of values and display them in grid format using the Matrix Chart.

Tomas Larsson avatar
Written by Tomas Larsson
Updated over a week ago

Keywords: matrix, grid, aggregation

The Matrix Chart workbench aggregates data for two sets of values, similar to "Group by field" in the Table View, and displays the results in grid format. An example of where this is useful is when mapping the number of occurrences of topics or tokens across dates, countries, authors, or other categories.

Step-by-step guide

1. Add a Matrix workbench

Click "Add workbench" and click Matrix Chart. The Matrix Chart workbench is now added to the workspace.

2. Specify the values to be used as columns

Drag a field from the Schema workbench or a set of values from any workbench and drop it in the "Display as columns" drop zone in the Matrix Chart workbench.

☝️ Note: All values dropped will be displayed, so be careful when working with fields with many values. For example, dropping a field with tokens (based on tokenization) could result in a matrix with thousands of columns. To reduce the number values displayed, first apply a filter or select and drag-and-drop the values you want to work with, for example from the Bubble workbench.

3. Specify the values to be used as rows

Drag a field from the Schema workbench or a set of values from any workbench and drop it in the "Display as rows" drop zone in the Matrix Chart workbench. The default function "Count(*)" (count occurrences) is applied and the data displayed in grid format.

4. Specify the aggregation function

To change the aggregation function, drag the field you want to use as source to the "Apply function & display on matrix" drop zone, then set the function.

πŸ‘‰ Example. In a dataset containing articles with associated topics, countries, and sentiment score, we have implemented the steps above to display a matrix with countries as columns and topics as rows. Rather than measuring each topic's occurrence in each country, we would like to understand the average sentiment of each topic in each country. We thus drag the "sentiment" field to the "Apply function & display on matrix" drop zone and select "Average" as the function. The cells now display the average sentiment per topic and country.

5. Adjust the settings if needed

The following settings are available:

  • Click the "Normalize" icon in the workbench header to normalize the matrix column-wise, row-wise, or matrix-wise.

  • Click the "Settings" icon in the workbench header to change the column source and selected values, row source and selected values, and aggregation function.

  • In the View options menu in the workbench header, switch on "Color" to color the cells based on their values.

  • In the View options menu in the workbench header, switch on "Text" to display the values inside the cells.

  • Click the "More" icon in the workbench header, then "Transpose" to transpose the matrix.

  • Click the "More" icon in the workbench header, then "Reset zoom" to reset the zoom level.

  • Click the "More" icon in the workbench header, then "Reset sorting" to reset the sorting of rows and columns. Sort by values in individual rows or columns in ascending or descending order by clicking the arrows that appear during mouse-over of row or column headers.

Did this answer your question?