Coloring by a categorical Z variable

      Coloring by a categorical Z variable


        Article summary

        See also this article on adding Z variables.

        If you add a categorical Z variable to a dot plot, histogram or a bar chart it will color the data points according to the category. This can help you see visually if there is a correlation between the Z variable and the others.

        Dot plot

        Here is a simple example where the Z variable, Direction, has two values, Left and Right.

        Histogram

        In the histogram case (numerical X, categorical Z) the histogram will be divided up into colored bars according to the Z variable:

        This is actually grouping by Z

        As the histogram has no other way to show the Z variable, this is actually a case of grouping by Z and will also mean that separate descriptive stats can be shown for each group. See this article about grouping by Z.

        Frequency Plot

        For a bar frequency plot (categorical X, categorical Z) it again splits the bars by the Z variable:

        Customizing colors

        In the examples above, the colors have been chosen from an automatic scale that ensures a good contrast. However, you might want to select the colors yourself. This can be done in the Values dialog for the column (located within the column header):


        This opens the Values dialog, that allows to you set colors (and labels) for each categorical value:



        See also

        Setting a DataMoji for each categorical value - see here

        Grouping data by a Z variable




        Was this article helpful?