﻿{"id":14396,"date":"2025-07-02T10:00:00","date_gmt":"2025-07-02T08:00:00","guid":{"rendered":"https:\/\/www.sigterritoires.fr\/?p=14396"},"modified":"2025-06-21T10:00:40","modified_gmt":"2025-06-21T08:00:40","slug":"crossing-spatial-selection-and-graphic-analysis-in-qgis-with-data-plotly","status":"publish","type":"post","link":"https:\/\/www.sigterritoires.fr\/index.php\/en\/crossing-spatial-selection-and-graphic-analysis-in-qgis-with-data-plotly\/","title":{"rendered":"Crossing spatial selection and graphic analysis in QGIS with Data Plotly"},"content":{"rendered":"\n<p>In our previous article, we discovered how to use the <a href=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/visualize-your-gis-data-in-qgis-with-the-data-plotly-plugin\/\">Data Plotly<\/a> plugin to create graphs directly in QGIS. Today, let&rsquo;s go a step further and learn how to dynamically filter the data displayed in graphs, using QGIS&rsquo;s selection tools and filter expressions.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-light-blue ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Contenu <\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/crossing-spatial-selection-and-graphic-analysis-in-qgis-with-data-plotly\/#Objective\" >Objective<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/crossing-spatial-selection-and-graphic-analysis-in-qgis-with-data-plotly\/#Starting_example_field_observations\" >Starting example: field observations<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/crossing-spatial-selection-and-graphic-analysis-in-qgis-with-data-plotly\/#Step_1_Create_a_standard_graph_with_Data_Plotly\" >Step 1: Create a standard graph with Data Plotly<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/crossing-spatial-selection-and-graphic-analysis-in-qgis-with-data-plotly\/#Step_2_Limit_analysis_to_selected_entities\" >Step 2: Limit analysis to selected entities<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/crossing-spatial-selection-and-graphic-analysis-in-qgis-with-data-plotly\/#Step_3_Filter_with_an_expression\" >Step 3: Filter with an expression<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/crossing-spatial-selection-and-graphic-analysis-in-qgis-with-data-plotly\/#Step_4_alternate_selections_for_comparison\" >Step 4: alternate selections for comparison<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/crossing-spatial-selection-and-graphic-analysis-in-qgis-with-data-plotly\/#Concrete_use_cases\" >Concrete use cases<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/crossing-spatial-selection-and-graphic-analysis-in-qgis-with-data-plotly\/#Bonus_tip_combine_with_%C2%AB_selection_sets\" >Bonus tip: combine with \u00ab\u00a0selection sets<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/crossing-spatial-selection-and-graphic-analysis-in-qgis-with-data-plotly\/#In_a_nutshell\" >In a nutshell<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/crossing-spatial-selection-and-graphic-analysis-in-qgis-with-data-plotly\/#Whats_next\" >What&rsquo;s next?<\/a><\/li><\/ul><\/nav><\/div>\n\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Objective\"><\/span>Objective<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Create interactive, context-sensitive graphics to :<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>View only data from a selected area on the map;<\/li>\n\n\n\n<li>Display comparisons between different subsets of data;<\/li>\n\n\n\n<li>Visually explore data from field campaigns or environmental observations.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Starting_example_field_observations\"><\/span>Starting example: field observations<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Let&rsquo;s imagine a point layer representing litter surveys on several beaches, with the following fields:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>beach: beach name<\/li>\n\n\n\n<li>type_of_waste: plastic, metal, glass, etc.<\/li>\n\n\n\n<li>quantity: number of objects found<\/li>\n\n\n\n<li>date_obs: date of observation<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_1_Create_a_standard_graph_with_Data_Plotly\"><\/span>Step 1: Create a standard graph with Data Plotly<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Select the survey layer.<\/li>\n\n\n\n<li>Launch Extensions &gt; Data Plotly &gt; Data Plotly Panel.<\/li>\n\n\n\n<li>Choose a bar plot :\n<ul class=\"wp-block-list\">\n<li>X : type_dechet<\/li>\n\n\n\n<li>Y : quantity<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Click on Create Plot \u2192 you&rsquo;ll get a histogram of all observations.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_2_Limit_analysis_to_selected_entities\"><\/span>Step 2: Limit analysis to selected entities<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u27a4 Selection on the map<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Activate the selection tool (rectangle, polygon, etc.) in the QGIS toolbar.<\/li>\n\n\n\n<li>Select one or more ranges.<\/li>\n<\/ul>\n\n\n\n<p>\u27a4 In Data Plotly:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Check the \u201cUse only selected features\u201d box before creating the graph.<\/li>\n\n\n\n<li>The graph will only take into account the selected features.<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2025\/06\/data_plotly_selected.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"465\" height=\"351\" data-attachment-id=\"14279\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/croiser-selection-spatiale-et-analyse-graphique-dans-qgis-avec-data-plotly\/data_plotly_selected\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2025\/06\/data_plotly_selected.jpg?fit=465%2C351&amp;ssl=1\" data-orig-size=\"465,351\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;1&quot;}\" data-image-title=\"data_plotly_selected\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2025\/06\/data_plotly_selected.jpg?fit=465%2C351&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2025\/06\/data_plotly_selected.jpg?resize=465%2C351&#038;ssl=1\" alt=\"\" class=\"wp-image-14279\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2025\/06\/data_plotly_selected.jpg?w=465&amp;ssl=1 465w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2025\/06\/data_plotly_selected.jpg?resize=300%2C226&amp;ssl=1 300w\" sizes=\"auto, (max-width: 465px) 100vw, 465px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p><strong>Example<\/strong>: this allows you to compare the amount of waste on a single beach, or a targeted area of coastline.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_3_Filter_with_an_expression\"><\/span>Step 3: Filter with an expression<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>For more precise analyses, use the Filter tool in the layer:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Right-click on the layer > Filter&#8230;<\/li>\n<\/ul>\n\n\n\n<p>Filter example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u201cbeach\u201d = \u2018Anse Mourouk\u2019 AND \u201cdate_obs\u201d &gt;= '2025-01-01'<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Apply the filter \u2192 only part of the data remains active.<\/li>\n<\/ul>\n\n\n\n<p>Then create a graph with Data Plotly: it will only take into account the filtered entities, even without manual selection.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_4_alternate_selections_for_comparison\"><\/span>Step 4: alternate selections for comparison<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Useful tip: create several successive graphs, each based on a different selection (e.g. range by range).<\/li>\n\n\n\n<li>You can then save each graph to generate a visual comparison in a report.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Concrete_use_cases\"><\/span>Concrete use cases<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Objective<\/th><th>Method<\/th><\/tr><\/thead><tbody><tr><td>Track pollution trends on a beach<\/td><td>Filter by beach + graph by date<\/td><\/tr><tr><td>Compare waste between north\/south beaches<\/td><td>Manual selection + histogram<\/td><\/tr><tr><td>Identify areas with the most metal<\/td><td>lSelection + sorting in the graph<\/td><\/tr><tr><td>Create thematic reports by site<\/td><td>Successive selections + graph export<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Bonus_tip_combine_with_%C2%AB_selection_sets\"><\/span>Bonus tip: combine with \u00ab\u00a0selection sets<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Use saved selection groups (menu Selection &gt; Save selection as group) to quickly toggle between several subsets.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"In_a_nutshell\"><\/span>In a nutshell<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>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:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Go beyond simple cartographic display;<\/li>\n\n\n\n<li>Explore correlations, anomalies or local trends;<\/li>\n\n\n\n<li>Produce targeted, exportable visualizations.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Whats_next\"><\/span>What&rsquo;s next?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In the next article, we&rsquo;ll look at how to automatically export a series of graphs for each entity (beach, commune, etc.), combining QGIS, dynamic expressions and Data Plotly.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In our previous article, we discovered how to use the Data Plotly plugin to create graphs directly in QGIS. Today, let&rsquo;s go a step further and learn how to dynamically filter the data displayed in graphs,&hellip;<\/p>\n","protected":false},"author":1,"featured_media":14400,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"give_campaign_id":0,"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"sfsi_plus_gutenberg_text_before_share":"","sfsi_plus_gutenberg_show_text_before_share":"","sfsi_plus_gutenberg_icon_type":"","sfsi_plus_gutenberg_icon_alignemt":"","sfsi_plus_gutenburg_max_per_row":"","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3394,1377],"tags":[3468,3466,1758,1386],"class_list":["post-14396","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-pluigin-en","category-qgis-en","tag-data-plotly-en","tag-filter","tag-plugin-en","tag-qgis-en"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2025\/06\/spatial-selection-and-graphic-analysis.jpg?fit=1024%2C1024&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p6XU0A-3Kc","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/posts\/14396","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/comments?post=14396"}],"version-history":[{"count":0,"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/posts\/14396\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/media\/14400"}],"wp:attachment":[{"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/media?parent=14396"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/categories?post=14396"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/tags?post=14396"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}