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',
This is where you do the edit:
The procedure gives us a very nice plot. Here with some test data:
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.