To do so I tried to follow this thread. I tested the following code to update the raster:
min = 1 max = 5 l.renderer().setClassificationMin(min) l.renderer().setClassificationMax(max)
I get the following error:
AttributeError: 'QgsSingleBandGrayRenderer' object has no attribute 'setClassificationMin'
I can't find any information about this code on the internet. The answer of the thread gives a solution but you HAVE to update the colour as well.
I'm wondering if somebody know how to update the min and max without updating the colour.