Adding colors to a cross table using Python

I am using a cross table whose cell values are controlled by a dropdown. Everytime I change the dropdown (and thus the visualisation) any color rules I have set up are lost.

Please can somebody provide the Python required to create color rules.

The code will firstly need to add a 'color scheme groupings', subsequently change the color mode to gradient, set 3 points by value and the specific color attached. I assume this must be possible but I'm stuggling to find the commands in the API. The attached image shows the rule I need to create.

Thank you!


Image icon color_rule.png145.59 KB

(1) Answer