Subgroup: Color
Class: QgsColorRampShader¶
-
class
qgis.core.
QgsColorRampShader
(minimumValue: float = 0, maximumValue: float = 255, colorRamp: QgsColorRamp = None, type: QgsColorRampShader.Type = QgsColorRampShader.Interpolated, classificationMode: QgsColorRampShader.ClassificationMode = QgsColorRampShader.Continuous)¶ Bases:
qgis._core.QgsRasterShaderFunction
Creates a new color ramp shader.
Parameters: - minimumValue – minimum value for the raster shader
- maximumValue – maximum value for the raster shader
- type – interpolation type used
- classificationMode – method used to classify the color ramp shader
- colorRamp – vector color ramp used to classify the color ramp shader
Returns: new QgsColorRampShader
QgsColorRampShader(other: QgsColorRampShader) Copy constructor
A ramp shader will color a raster pixel based on a list of values ranges in a ramp.
Methods
classificationMode
Returns the classification mode classifyColorRamp
Classify color ramp shader classifyColorRampV2
Classify color ramp shader clip
Returns whether the shader will clip values which are out of range. colorRampItemList
Get the custom colormap colorRampType
Get the color ramp type colorRampTypeAsQString
Get the color ramp type as a string legendSymbologyItems
Get symbology items if provided by renderer setClassificationMode
Sets classification mode setClip
Sets whether the shader should not render values out of range. setColorRampItemList
setColorRampType
Set the color ramp type setSourceColorRamp
Set the source color ramp. shade
Generates and new RGB value based on one input value sourceColorRamp
Get the source color ramp Signals
Attributes
Continuous
Discrete
EqualInterval
Exact
Interpolated
Quantile
-
class
ClassificationMode
¶ Bases:
int
-
class
ColorRampItem
¶ Bases:
sip.wrapper
default constructor
QgsColorRampShader.ColorRampItem(val: float, col: Union[QColor, Qt.GlobalColor, QGradient], lbl: str = ‘’) convenience constructor
QgsColorRampShader.ColorRampItem(QgsColorRampShader.ColorRampItem)
-
color
¶
-
label
¶
-
value
¶
-
-
Continuous
= 1¶
-
Discrete
= 1¶
-
EqualInterval
= 2¶
-
Exact
= 2¶
-
Interpolated
= 0¶
-
Quantile
= 3¶
-
class
Type
¶ Bases:
int
-
classificationMode
(self) → QgsColorRampShader.ClassificationMode¶ Returns the classification mode
-
classifyColorRamp
(self, classes: int = 0, band: int = -1, extent: QgsRectangle = QgsRectangle(), input: QgsRasterInterface = None)¶ Classify color ramp shader
Parameters: - classes – number of classes
- band – raster band used in classification (only used in quantile mode)
- extent – extent used in classification (only used in quantile mode)
- input – raster input used in classification (only used in quantile mode)
-
classifyColorRampV2
(self, band: int = -1, extent: QgsRectangle = QgsRectangle(), input: QgsRasterInterface = None)¶ Classify color ramp shader
Parameters: - band – raster band used in classification (quantile mode only)
- extent – extent used in classification (quantile mode only)
- input – raster input used in classification (quantile mode only)
-
clip
(self) → bool¶ Returns whether the shader will clip values which are out of range.
See also
-
colorRampItemList
(self) → object¶ Get the custom colormap
-
colorRampType
(self) → QgsColorRampShader.Type¶ Get the color ramp type
-
colorRampTypeAsQString
(self) → str¶ Get the color ramp type as a string
-
legendSymbologyItems
(self) → List[Tuple[str, QColor]]¶ Get symbology items if provided by renderer
-
setClassificationMode
(self, classificationMode: QgsColorRampShader.ClassificationMode)¶ Sets classification mode
-
setClip
(self, clip: bool)¶ Sets whether the shader should not render values out of range.
Parameters: clip – set to true to clip values which are out of range. See also
-
setColorRampItemList
(self, list: Iterable[QgsColorRampShader.ColorRampItem])¶
-
setColorRampType
(self, colorRampType: QgsColorRampShader.Type)¶ Set the color ramp type
- setColorRampType(self, type: str)
- Set the color ramp type
-
setSourceColorRamp
(self, colorramp: QgsColorRamp)¶ Set the source color ramp. Ownership is transferred to the renderer.
New in version 3.0.
See also
-
shade
(self, value: float) → Tuple[bool, int, int, int, int]¶ Generates and new RGB value based on one input value
- shade(self, redValue: float, greenValue: float, blueValue: float, alphaValue: float) -> Tuple[bool, int, int, int, int]
- Generates and new RGB value based on original RGB value
-
sourceColorRamp
(self) → QgsColorRamp¶ Get the source color ramp
New in version 3.0.
See also