In our previous article, we discovered how to use the Data Plotly plugin to create graphs directly in QGIS. Today, let’s go a step further and learn how to dynamically filter the data displayed in graphs, using QGIS’s selection tools and filter expressions.
Objective
Create interactive, context-sensitive graphics to :
- View only data from a selected area on the map;
- Display comparisons between different subsets of data;
- Visually explore data from field campaigns or environmental observations.
Starting example: field observations
Let’s imagine a point layer representing litter surveys on several beaches, with the following fields:
- beach: beach name
- type_of_waste: plastic, metal, glass, etc.
- quantity: number of objects found
- date_obs: date of observation
Step 1: Create a standard graph with Data Plotly
- Select the survey layer.
- Launch Extensions > Data Plotly > Data Plotly Panel.
- Choose a bar plot :
- X : type_dechet
- Y : quantity
- Click on Create Plot → you’ll get a histogram of all observations.
Step 2: Limit analysis to selected entities
➤ Selection on the map
- Activate the selection tool (rectangle, polygon, etc.) in the QGIS toolbar.
- Select one or more ranges.
➤ In Data Plotly:
- Check the “Use only selected features” box before creating the graph.
- The graph will only take into account the selected features.

Example: this allows you to compare the amount of waste on a single beach, or a targeted area of coastline.
Step 3: Filter with an expression
For more precise analyses, use the Filter tool in the layer:
- Right-click on the layer > Filter…
Filter example:
“beach” = ‘Anse Mourouk’ AND “date_obs” >= '2025-01-01'
- Apply the filter → only part of the data remains active.
Then create a graph with Data Plotly: it will only take into account the filtered entities, even without manual selection.
Step 4: alternate selections for comparison
- Useful tip: create several successive graphs, each based on a different selection (e.g. range by range).
- You can then save each graph to generate a visual comparison in a report.
Concrete use cases
Objective | Method |
---|---|
Track pollution trends on a beach | Filter by beach + graph by date |
Compare waste between north/south beaches | Manual selection + histogram |
Identify areas with the most metal | lSelection + sorting in the graph |
Create thematic reports by site | Successive selections + graph export |
Bonus tip: combine with “selection sets
Use saved selection groups (menu Selection > Save selection as group) to quickly toggle between several subsets.
In a nutshell
Thanks to interactive selections and filters in QGIS, Data Plotly becomes a true visual analysis dashboard, directly connected to your GIS data. This allows you to:
- Go beyond simple cartographic display;
- Explore correlations, anomalies or local trends;
- Produce targeted, exportable visualizations.
What’s next?
In the next article, we’ll look at how to automatically export a series of graphs for each entity (beach, commune, etc.), combining QGIS, dynamic expressions and Data Plotly.