OEColorGradientDisplayOptions

class OEColorGradientDisplayOptions

This class represents the OEColorGradientDisplayOptions class that holds properties that determine how a color gradient is rendered.

See also

Constructors

OEColorGradientDisplayOptions() -> OEColorGradientDisplayOptions

Default constructor.

../../_images/OEColorGradientDisplayOptions_Default.png

Example of drawing a color gradient with default options

OEColorGradientDisplayOptions(rhs: OEColorGradientDisplayOptions) -> OEColorGradientDisplayOptions

Copy constructor.

AddLabel

AddLabel(label: OEColorGradientLabel) -> None

Adds an additional label that will be rendered on the strip of the color gradient.

label

The OEColorGradientLabel object that defines the label and the position where the label is going to be rendered to the color gradient.

Example:

opts = oegrapheme.OEColorGradientDisplayOptions()
opts.AddLabel(oegrapheme.OEColorGradientLabel(-1.0, "dissimilar"))
opts.AddLabel(oegrapheme.OEColorGradientLabel(+1.0, "similar"))
oegrapheme.OEDrawColorGradient(image, colorg, opts)

Full listing.

../../_images/OEColorGradientDisplayOptions_AddLabel.png

Example of using the AddLabel method

AddMarkedValue

AddMarkedValue(value: float) -> None

Adds an additional value that will be marked on the strip of the color gradient along with the label of the value above the strip.

Example:

opts = oegrapheme.OEColorGradientDisplayOptions()
opts.AddMarkedValue(0.20)
oegrapheme.OEDrawColorGradient(image, colorg, opts)

Full listing.

../../_images/OEColorGradientDisplayOptions_AddMarkedValue.png

Example of using the AddMarkedValue method

AddMarkedValues

AddMarkedValues(values: OEDoubleVector) -> None

Adds additional values that will be marked on the strip of the color gradient along with their labels above the strip.

Example:

opts = oegrapheme.OEColorGradientDisplayOptions()
markedvalues = oechem.OEDoubleVector([0.20, 0.70, 0.72])
opts.AddMarkedValues(markedvalues)
oegrapheme.OEDrawColorGradient(image, colorg, opts)

Full listing.

../../_images/OEColorGradientDisplayOptions_AddMarkedValues.png

Example of using the AddMarkedValues method

ClearBoxRange

ClearBoxRange() -> None

Removes the range previously set to be marked on the color gradient.

ClearLabels

ClearLabels() -> None

Removes labels previously set by the OEColorGradientDisplayOptions.AddLabel method to be marked on the color gradient.

ClearMarkedValues

ClearMarkedValues() -> None

Removes any values previously set to be marked on the color gradient.

GetBoxRangeMax

GetBoxRangeMax() -> float

Returns the minimum value of the range being marked on the color gradient.

GetBoxRangeMin

GetBoxRangeMin() -> float

Returns the maximum value of the range being marked on the color gradient.

GetBoxRangePen

Returns the pen used to draw the box to mark the range set by the OEColorGradientDisplayOptions.SetBoxRange method.

GetBoxRangePen() -> OEPen

GetColorStopLabelFont

GetColorStopLabelFont() -> OEFont

Returns the font that is used to render the color stops of the color gradient.

GetColorStopLabelFontScale

GetColorStopLabelFontScale() -> float

Returns the multiplier that can be used to increase or decrease the size of the color stop label fonts.

GetColorStopPrecision

GetColorStopPrecision() -> int

Returns the precision of the color stop labels i.e. the number of digits that is written to express the floating-point values.

GetColorStopVisibility

GetColorStopVisibility() -> bool

Returns whether the color stop labels are rendered.

GetLabels

GetLabels() -> Iterable[OEColorGradientLabel]

Returns an iterator over the labels that are being rendered onto the color gradient.

GetMarkedValuePen

GetMarkedValuePen() -> OEPen

Returns the pen that is used to draw the lines for the marked values.

GetMarkedValuePrecision

GetMarkedValuePrecision() -> int

Returns the precision of the marked value labels i.e. the number of digits that is written to express the floating-point values.

GetMarkedValues

GetMarkedValues() -> Iterable[float]

Returns an iterator over the values that are being marked on the color gradient.

SetBoxRange

SetBoxRange(minvalue: float, maxvalue: float) -> None

Sets the range being marked on the color gradient.

minvalue, maxvalue

The minimum and maximum value of the range.

Example:

opts = oegrapheme.OEColorGradientDisplayOptions()
opts.SetBoxRange(-0.5, 0.5)
oegrapheme.OEDrawColorGradient(image, colorg, opts)

Full listing.

../../_images/OEColorGradientDisplayOptions_SetBoxRange.png

Example of using the SetBoxRange method

SetBoxRangePen

SetBoxRangePen(pen: OEPen) -> None

Sets the pen used to mark a specified range on the color gradient.

Example:

opts = oegrapheme.OEColorGradientDisplayOptions()
opts.SetBoxRange(-0.5, 0.5)
pen = oedepict.OEPen(oechem.OEBlack, oechem.OEBlack, oedepict.OEFill_On,
                     2.0, oedepict.OEStipple_ShortDash)
opts.SetBoxRangePen(pen)
oegrapheme.OEDrawColorGradient(image, colorg, opts)

Full listing.

../../_images/OEColorGradientDisplayOptions_SetBoxRangePen.png

Example of using the SetBoxRangePen method

SetColorStopLabelFont

SetColorStopLabelFont(font: OEFont) -> None

Sets the font that is used to render color stops of the color gradient.

Example:

opts = oegrapheme.OEColorGradientDisplayOptions()
font = oedepict.OEFont()
font.SetColor(oechem.OEDarkGreen)
font.SetStyle(oedepict.OEFontStyle_Bold)
opts.SetColorStopLabelFont(font)
oegrapheme.OEDrawColorGradient(image, colorg, opts)

Full listing.

../../_images/OEColorGradientDisplayOptions_SetColorStopLabelFont.png

Example of using the SetColorStopLabelFont method

Note

The size of font also depends on dimensions of the image into which the color gradient is rendered. See also OEDrawColorGradient function.

SetColorStopLabelFontScale

SetColorStopLabelFontScale(scale: float) -> None

Sets the multiplier that can be used increase or decrease the size of the fonts of the color stop labels.

scale

This value has to be in the range of [0.5, 3.0].

Example:

opts = oegrapheme.OEColorGradientDisplayOptions()
opts.SetColorStopLabelFontScale(0.5)
oegrapheme.OEDrawColorGradient(image, colorg, opts)

Full listing.

../../_images/OEColorGradientDisplayOptions_SetColorStopLabelFontScale.png

Example of using the SetColorStopLabelFontScale method

SetColorStopPrecision

SetColorStopPrecision(precision: int) -> None

Sets the precision of the color stop labels i.e. the number of digits that is written to express the floating-point values.

precision

The zero value means that the precision is determined by the lowest significant digits of the color stop values that is in the range of [1,4].

Example:

opts = oegrapheme.OEColorGradientDisplayOptions()
opts.SetColorStopPrecision(4)
oegrapheme.OEDrawColorGradient(image, colorg, opts)

Full listing.

../../_images/OEColorGradientDisplayOptions_SetColorStopPrecision.png

Example of using the SetColorStopPrecision method

SetColorStopVisibility

SetColorStopVisibility(visible: bool) -> None

Sets whether the color stop labels are rendered.

Example:

opts = oegrapheme.OEColorGradientDisplayOptions()
opts.SetColorStopVisibility(False)
oegrapheme.OEDrawColorGradient(image, colorg, opts)

Full listing.

../../_images/OEColorGradientDisplayOptions_SetColorStopVisibility.png

Example of using the SetColorStopVisibility method

SetMarkedValuePen

SetMarkedValuePen(pen: OEPen) -> None

Sets the pen that is used to draw the lines for the marked values.

Example:

opts = oegrapheme.OEColorGradientDisplayOptions()
markedvalues = oechem.OEDoubleVector([0.20, 0.70, 0.72])
opts.AddMarkedValues(markedvalues)
pen = oedepict.OEPen(oechem.OEBlack, oechem.OEDarkGreen, oedepict.OEFill_On,
                     2.0, oedepict.OEStipple_ShortDash)
opts.SetMarkedValuePen(pen)
oegrapheme.OEDrawColorGradient(image, colorg, opts)

Full listing.

../../_images/OEColorGradientDisplayOptions_SetMarkedValuePen.png

Example of using the SetMarkedValuePen method

SetMarkedValuePrecision

SetMarkedValuePrecision(precision: int) -> None

Sets the precision of the marked value labels i.e. the number of digits that is written to express the floating-point values. Decreasing the precision can result in collapsing that labels of two or more distinct values into one label.

Example:

opts = oegrapheme.OEColorGradientDisplayOptions()
markedvalues = oechem.OEDoubleVector([0.20, 0.70, 0.72])
opts.AddMarkedValues(markedvalues)
opts.SetMarkedValuePrecision(1)
oegrapheme.OEDrawColorGradient(image, colorg, opts)

Full listing.

../../_images/OEColorGradientDisplayOptions_SetMarkedValuePrecision.png

Example of using the SetMarkedValuePrecision method

SetMarkedValues

SetMarkedValues(values: OEDoubleVector) -> None

Initializes values that will be marked on the strip of the color gradient along with the value labels above the strip. OEColorGradientDisplayOptions.SetMarkedValues method discards the list of values set in prior calls.

Example:

opts = oegrapheme.OEColorGradientDisplayOptions()
opts.AddMarkedValue(0.0)
markedvalues = oechem.OEDoubleVector([0.5, 0.75])
opts.SetMarkedValues(markedvalues)
oegrapheme.OEDrawColorGradient(image, colorg, opts)

Full listing.

../../_images/OEColorGradientDisplayOptions_SetMarkedValues.png

Example of using the SetMarkedValues method