On this page


Diagrams showing multiple aspects of the system are often difficult to understand and analyze since they are quite crowded. Filtering diagrams by Legend items enables users to reduce diagrams to the chosen views only, i.e., hide unnecessary layers or show only a few necessary ones in order to make them more comprehensible. The feature is especially useful when there is a need to present to stakeholders only one  (e.g., electrical) or a few aspects displayed in the diagram.

Filtering a diagram by the selected Legend item iElectricity.
Filtering preference is set to Show (on the left) and Hide (on the right).

Filtering diagram by Legend items

Once you have created or automatically extracted a Legend and specified Legend items for it, you can filter your diagram by Legend items to highlight the chosen layers.

You can filter the diagram directly from:

Selecting filtering preference

Before using the filter, you need to select the filtering preference. There are two options you can choose from: Show or Hide.

Selecting the Show preference allows you to display the element symbols filtered by a Legend item while hiding all the other element symbols. Selecting the Hide preference allows you to hide the element symbols filtered by a Legend item while all the other element symbols of the diagram are displayed. Keep in mind that only one preference can be selected - the Show and Hide preferences cannot be combined. 

Selecting the filtering preference for a specific diagram

To select the filtering preference for a specific diagram


  1. Open a diagram you want to filter.
  2. In the diagram toolbar, click  Filter by Legend Items.

  3. In the open dialog, select either Show or Hide to set the preference to filter your diagram by.

    • The default filtering preference is Show. You can change it via the Legends project option.
    • If there are multiple Legends on the diagram, the same preference applies to all of them. 
    • If the applied filter is saved, the filtering preference remains as is once the diagram is closed and reopened. Otherwise, the preference resets to default.
  4. Click OK.

Filtering comments using different filtering preferences:

  • Hide: all comments are hidden;
  • Show: all comments are shown including anchored elements.

Selecting the default filtering preference

The default filtering preference is Show, however, you can change it via the Project Options. The change applies to all existing and future diagrams of the project, except for diagrams with an already applied filter.

To select the default filtering preference 


  1. In the main toolbar, click Options > Project. The Project Options dialog opens.
  2. In the General options group, select Legends.
  3. Set the Filtering Preference option to Show or Hide. Click OK.

Filtering when Legend shape is displayed 

If the Legend shape is displayed on the diagram pane, you can filter your diagram by Legend items directly from it. To be more specific, you can either filter your diagram from the smart manipulator toolbar of the Legend shape or the selected Legend item(s) shortcut menuThe latter method comes in handy when there is a need to filter the diagram by multiple Legend items at once. 

Filtering by Legend items from the smart manipulator toolbar

To filter a diagram by the selected Legend item


  1. Open a diagram you want to filter.
  2. In the Legend shape on the diagram pane, select a Legend item to filter your diagram by. 
  3. In the smart manipulator toolbar, click  .

    The diagram is filtered by the selected Legend item, meaning that the diagram is limited to one specific aspect. If the filtering preference is Show, the diagram displays only the element symbols filtered by the Legend item, while the rest of the element symbols are hiddenIf the filtering preference is Hide, the diagram hides the element symbols filtered by the Legend item while the rest of the element symbols are displayed.  

    To filter the diagram by multiple Legend items, repeat the procedure.


To filter a diagram by all Legend items at once


  1. Select a Legend shape on the diagram pane.
  2. In the smart manipulator toolbar, click. The diagram is filtered by all items specified in the Legend, meaning that all diagram aspects are either hidden or displayed. 

Filtering by Legend items from the shortcut menu

To filter a diagram by the selected Legend items from the shortcut menu


  1. In the Legend shape on a diagram, select the Legend item(s) to filter your diagram by.
  2. Right-click and then in the shortcut menu, select Filtered

Filtering when Legend shape is not displayed 

Alternatively, you can filter your diagram by the selected Legend items directly from the diagram toolbar. This is the primary filtering method when the Legend shape is not displayed on the diagram. In this case, you can select whether to filter the diagram by a single or multiple Legend items as well.


To filter a diagram by the selected Legend item(s)


  1. Open a diagram you want to filter.
  2. In the diagram toolbar, click   > Filter by Legend Items.

  3. In the open dialog, specify the filtering preference.
  4. Select the Legend items to filter your diagram by.
  5. Click OK

Managing and removing the applied filter

Once diagram layers are filtered, the following notification appears above the diagram:

  • Click Clear to clear the applied filter. 

  • Click Save to keep the filter applied after the diagram is reloaded. 

Alternatively, to clear the applied filter, you can:

  • clickin the smart manipulator toolbar of the selected Legend item.

  • uncheck the box next to Filtered in the Legend item shortcut menu.

  • clear the corresponding boxes in the Filter by Legend Items ( > Filter by Legend Items) dialog.

The diagram filtered by Legend items is read-only, meaning that it cannot be edited unless the filter is removed.

Sample model

The model used in the figures on this page is the Layers sample model that comes with the SysML plugin. To open this model, do one of the following:

  • Download layers.mdzip
  • Open the model from the <modeling tool installation directory>\samples\SysML directory.

Related pages