2

I am making a sensitivity atlas which gives me gridded sensitivity values (A to E) for a given area. I am using the atlas functionality in QGIS 3.10 to create several maps showing these sensitivity attributts for different regions. The categories within a region is presented in several plots. I would like to link the layer styling to the styling of the plot layout.

In the below map you will see that I have a rule based styling where I give the values from A to E an increasing redness. I would like the statistics shown in the plot grids to have similar styling. Baing able to control the order of the objects in the plot (A to E) would also be a pre.

Is there a way to do this?

Test map for creating statistics related to map items

  • I dried exporting the plotly config xml. It did not contain any relevant colour references. – ragnvald Nov 25 '19 at 11:36
2

It is possible to set conditional styling on the for the plots. This answer is made based on experiences in QGIS 3.10 and the Plotly plugin version 3.0.

The procedure starts with the user setting the properties for the bar color. Choose the data defined override cirkled with a red pen illustrated in the below image.

In my case I want to categorise by counting the number of attribute local_sensitivity_code_max where the values are from A to E. To be able to do this I need several conditionals. Luckily is possible to create an nested conditional this way:

if(  "local_sensitivity_code_max" ='A','#bd0026',
if(  "local_sensitivity_code_max" ='B','#f03b20',
if(  "local_sensitivity_code_max" ='C','#fd8d3c',
if(  "local_sensitivity_code_max" ='D','#fecc5c',
if(  "local_sensitivity_code_max" ='E','#ffffb2',
'#FFFFFF')))))

This is where you do the edit:

enter image description here

The procedure gives us a very nice plot. Here with some test data:

enter image description here

Using Plotly this way, combining it with the atlas functionality in QGIS, I am able to render a full series of maps with associated statistics.

Although it works there are still some quirks:

  • The count of features seem to be inaccurate. But it is very likely a user err on my side.
  • The legend colour can only be set to one color. Disabling it should be an option since the legend for the map is complementary. Seems like it is not possible to disable it.
  • I would like to be able to set the order of the bars. It now changes randomly.
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.