---
schema_version: "1"
id: 51ed3357d37e4e7d5078478fe07df8b16f57742d7489812a5d3bbe3f01bd9c87
title: 使用组为视图设置颜色
collection: tableau
version: current
locale: zh-cn
portal_url: https://docs.salesforce.com/tableau/current/zh-cn/pro/desktop/sortgroup_groups_editing.md
canonical_url: https://help.tableau.com/current/pro/desktop/zh-cn/sortgroup_groups_editing.htm
source_site: help.tableau.com
content_type: documentation
content_hash: afbfde303f39dedadeb1ff0f6789a9c4b77b98f4aafb9e4d866e1969cfe28fc9
description: Color a view by selecting marks to create visual groups.
---
[跳转到主要内容](#main-content)

# 使用组为视图设置颜色

除了更正数据错误和合并维度以外，您还可从视觉上判断相关标记的分组，只需直接选择标记即可。如果使用的散点图或视图没有可供在定义组时选择的标题，此方法尤其有用。

1. 按住键盘上的 Ctrl 或 Shift 键以选择视图中的一个或多个标记。在 Mac 上，请使用 Shift 键。
2. 若要创建组，请执行以下操作之一：
    
    - 对于 Tableau Desktop，单击工具栏上的“组”按钮 ![一个回形针附件图标和一个上下文菜单图标。](/tableau/current/zh-cn/pro/desktop/zh-cn/Img/ad-hoc1.png)，或者右键单击并选择“组”。
    - 对于 Tableau Server 或 Tableau Cloud，单击工具提示上的“组” 图标。
    
    ![带有两个数据点簇的散点图，一个在左下方，一个在右上方，并带有突出显示的附件图标。](/tableau/current/zh-cn/pro/desktop/zh-cn/Img/ad-hoc14.png)

所选标记将分成一组，而所有其他成员将合并到“Other”类别中。新的组字段将自动添加到“颜色”。有关使用“其他”对字段进行分组的详细信息，请参见[包括其他组](https://help.tableau.com/current/pro/desktop/zh-cn/sortgroup_groups_creating.htm#Include)。

![显示利润和销售额之间关系的散点图，按子类细分。](/tableau/current/zh-cn/pro/desktop/zh-cn/Img/ad-hoc15.png)

**注意：** 如果“颜色”中已经存在字段，则这些字段将移到“详细信息”中并将被组字段替换。

当您通过选择标记来创建组时，这些标记可能表示多个维度。例如，可能有一个散点图显示“Sales vs. “Profit by Region”（按区域列出的利润）和“Sub-Category”（子类）。在本例中，所选标记表示“Region”（区域）和“Sub-Category”（子类）维度的成员。当所选内容表示多个维度时，使用“组”菜单可以在“所有维度”或特定维度上进行分组。

![带有显示附件选项的工具提示的散点图。](/tableau/current/zh-cn/pro/desktop/zh-cn/Img/ad-hoc16.png)

在上例中，5 个所选标记表示地区和以下子类组合。

- West, Copiers（西部，复印机）
- West, Binders（西部，装订机）
- West, Accessories（西部，配件）
- East, Copiers（东部，复印机）
- Central, Copiers（中部，复印机）
- South, Art
- South, Envelopes
- South, Labels
- West, Envelopes
- West, Labels

以下各视图显示对“所有维度”、“子类”和“区域”上的这些度量进行分组的结果。

<table class="table--plain"><tbody><tr><th>所有维度</th><th>子类</th><th>区域</th></tr><tr><td><img src="https://help.tableau.com/current/pro/desktop/zh-cn/Img/ad-hoc17.png" alt="显示利润和销售额之间关系的散点图，按子类细分。"></td><td><img src="https://help.tableau.com/current/pro/desktop/zh-cn/Img/ad-hoc18.png" alt="具有两个数据点簇的散点图。"></td><td><img src="https://help.tableau.com/current/pro/desktop/zh-cn/Img/ad-hoc19.png" alt="散点图直观地展现了利润和销售额之间的相关性，并用颜色标记了地区差异。"></td></tr><tr><td style="vertical-align: top;">这 5 个标记将合并在一起，而其余标记将添加到“Other”类别中。</td><td style="vertical-align: top;">与三个子类中的任何一个关联的所有标记都将合并在一起，而所有其他标记将添加到“Other”类别中。</td><td style="vertical-align: top;">与四个区域中关联的所有标记都将合并在一起，而所有其他标记将添加到“Other”类别中。</td></tr></tbody></table>