--- title: "Visualizing Z variable using color" slug: "coloring-by-categorical-z" updated: 2025-09-11T13:01:43Z published: 2025-09-11T13:01:43Z canonical: "userguide.dataclassroom.com/coloring-by-categorical-z" --- > ## Documentation Index > Fetch the complete documentation index at: https://userguide.dataclassroom.com/llms.txt > Use this file to discover all available pages before exploring further. # Visualizing Z variable using color *Before you play with color, pick your z-variable:* ![](https://cdn.document360.io/62f8f41e-e041-42c4-b9bc-8ae1eb45d064/Images/Documentation/z.png) ## **Using Color to Visualize the z variable:** 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 an example of the same graph, but two different z-variable types: - Categorical -  **Character Gender** has two values, **F** and **M** and is represented by two distinct colors - Numeric - **age difference** creates a scale of color to represent the numerical values. ![](https://cdn.document360.io/62f8f41e-e041-42c4-b9bc-8ae1eb45d064/Images/Documentation/Untitled%20drawing-22.png) ### Histogram In the histogram case (numerical X, categorical Z) the histogram will be divided up into colored bars according to the Z variable: ![](https://cdn.document360.io/62f8f41e-e041-42c4-b9bc-8ae1eb45d064/Images/Documentation/image-1617972723014.png) 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](/v1/docs/grouping-by-a-z-variable). ### Frequency Plot For a bar frequency plot (categorical X, categorical Z) it again splits the bars by the Z variable: ![](https://cdn.document360.io/62f8f41e-e041-42c4-b9bc-8ae1eb45d064/Images/Documentation/image-1617972847794.png) ### 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): ![](https://cdn.document360.io/62f8f41e-e041-42c4-b9bc-8ae1eb45d064/Images/Documentation/image-1756062309234.png) 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](/v1/docs/fun-with-datamojis) [Grouping data by a Z variable](/v1/docs/grouping-by-a-z-variable)