# Set-Matrix : Exploring relations in multiple categories

With an intuitive design unmatched in any other tool, Keshif supports rich and easy analysis of multiple categorical values for each record. Examples include multi-answer questions, genres of movies or tags of articles/resources.

### Preparing Multi-Categorical Data

To be able to create describe multiple categories in a single chart for analysis, you can include all categories in a single cell of your data (if you are using a spreadsheet), and split (separate) each category/option with a special separating character, such as

Note: The separating character should not appear in any category. So, if a category includes the ; character, you should use a different character, such as * or + as separator in your data source. Another option is to store and load this data as JSON strings, such as ["Apples","Bananas"].

#### Converting data in multiple columns to a single column

In some cases, your original data may include one column for each potential category, and denote whether each category is present or not. You can prepare your data by adding a new column with a formula that checks data in other columns, and merges all categories that appear in a single value.

A screenshot below demonstrates a sample data prepared in this way. The related formula is

```ARRAYFORMULA(IF(B2:B = "Yes","Apples;","") & IF(C2:C="Yes","Oranges;","") & IF(D2:D="Yes","Bananas ; ",""))
```
• ARRAYFORMULA = is useful to expand a single formula to all of the column
• IF( B2:B = "Yes", "Apples ; ","" ) = You can change "B" to the column, "Yes" to the answer you'd like to capture, and "Apples;" to the output on this condition, including the ; separator character
• Then, you merge results from multiple column using & between each column.

You can find this sample sheet  here.

### Set Matrix: Rich Analysis of Relations Cross Caterogies

While seeing the basic distribution of your categorical data is great for overview, you can explore deeper into relationships between different categories of data. That’s where set-matrix charts come in, which is specially designed for multi-categorical data.
With set matrix, you can see quickly which categories appear together, and how frequently. Each circle represents the records at the intersection of two categories. Larger circles (intersections of two categories) have more records, or in other words, are more frequent in the dataset.

To create matrix charts for multi-categorical features, simply click on the “Show pair-wise relations” icon on top of a multi-valued bar chart.

A movie can have multiple genres. With Keshif, you can parse multiple genres automatically, and create matrix-plots with a single click. The circle at intersection of action & thriller is large, which means these genres are frequently together.

We have published design details, and strategies that can empower your analytics using our matrix plots. You can find our paper and sample datasets at  keshif.me/AggreSet. We include the video overview of the technique and various strategies below. Note that current Keshif version may have updated the look and some features demonstrated in this video.