Contour

(Source code, png)

../../_images/Contour.png
class Contour(*args)

Contour.

Available constructors:

Contour(dimX, dimY, data)

Contour(sampleX, sampleY, data)

Parameters:
dimX, dimYint

Dimensions of data.

data2-d sequence of float of dimension 1 and of size dimX*dimY

These values are those of a function f: \Rset^2 \rightarrow \Rset on each point of the grid with dimX points along the X-direction and dimY points along the Y-direction. The (X, Y)- values are stored row-by-row.

sampleX, sampleYtwo 2-d sequences of float of dimension 1

First and second coordinates. If not specified the points are equally spaced in [0, 1] along the X and Y-directions.

Examples

Using the first constructor:

>>> import openturns as ot
>>> f = ot.SymbolicFunction(['x', 'y'], ['exp(-sin(cos(y)^2*x^2+sin(x)^2*y^2))'])
>>> # Generate the data for the curves to be drawn
>>> nX = 75
>>> nY = 75
>>> inputData = ot.Box([nX, nY]).generate()
>>> inputData *= [10.0] * 2
>>> inputData += [-5.0] * 2
>>> data = f(inputData)
>>> levels = [(0.5 + i) / 5 for i in range(5)]
>>> # Create an empty graph
>>> myGraph = ot.Graph('Complex iso lines', 'u1', 'u2', True)
>>> # Create the contour
>>> myContour = ot.Contour(nX + 2, nY + 2, data)
>>> myContour.setLevels(levels)
>>> myGraph.add(myContour)

Using the second constructor:

>>> import openturns as ot
>>> g = ot.SymbolicFunction(['R','S'],['(R * S)^0.75'])
>>> # Generate the data for the curves to be drawn
>>> nX = 10
>>> nY = 10
>>> lowerBound = [1.6, 0.0]
>>> upperBound = [6.3, 4.3]
>>> bounds = ot.Interval(lowerBound, upperBound)
>>> boxExperiment = ot.Box([nX, nY], bounds)
>>> inputSample = boxExperiment.generate()
>>> outputSample = g(inputSample)
>>> # Generate the grid for the contour plot
>>> xstep = (upperBound[0] - lowerBound[0])/(nX + 1)
>>> x = ot.RegularGrid(lowerBound[0], xstep, nX + 2).getVertices()
>>> ystep = (upperBound[1] - lowerBound[1])/(nY + 1)
>>> y = ot.RegularGrid(lowerBound[1], ystep, nY + 2).getVertices()
>>> # Create an empty graph
>>> myGraph = ot.Graph('Complex iso lines', 'u1', 'u2', True, '')
>>> levels = [-1.0, 1.0, 3.0, 5.0, 7.0, 9.0]
>>> labels = ['Level 0', 'Level 1', 'Level 2', 'Level 3', 'Level 4', 'Level 5']
>>> drawLabels = True
>>> # Create the contour and plot it
>>> myContour = ot.Contour(x, y, outputSample)
>>> myContour.setLevels(levels)
>>> myContour.setLabels(labels)
>>> myContour.setDrawLabels(drawLabels)
>>> myGraph.add(myContour)

Methods

BuildDefaultPalette(size)

Build default palette.

BuildRainbowPalette(size)

Build rainbow palette.

BuildTableauPalette(size)

Build tableau palette.

ConvertFromHSV(hue, saturation, value)

Convert an HSV triplet to a valid hexadecimal code.

ConvertFromHSVA(hue, saturation, value, alpha)

Convert an HSVA quadruplet to a valid hexadecimal code.

ConvertFromHSVIntoRGB(hue, saturation, value)

Convert an HSV triplet into an RGB triplet.

ConvertFromName(name)

Convert a color name to a valid hexadecimal code.

ConvertFromRGB(*args)

Convert an RGB triplet to a valid hexadecimal code.

ConvertFromRGBA(*args)

Convert an RGBA quadruplet to a valid hexadecimal code.

ConvertFromRGBIntoHSV(*args)

Convert an RGB triplet to HSV triplet.

ConvertToRGB(key)

Convert an hexadecimal code into an RGB triplet.

ConvertToRGBA(key)

Convert an hexadecimal code into an RGBA quadruplet.

GetValidColorBarPositions()

Return the list of the valid color bar positions of contour drawables.

GetValidColorMaps()

Return the list of the valid color maps of contour drawables.

GetValidColors()

Return the list of the valid colors of the drawable element.

GetValidExtends()

Return the list of the valid coloration extends of contour drawables.

GetValidFillStyles()

Return the list of the valid fill styles of the drawable element.

GetValidLineStyles()

Return the list of the valid line styles of the drawable element.

GetValidNorms()

Return the list of the valid norms of contour drawables.

GetValidPointStyles()

Return the list of the valid point styles of the drawable element.

buildDefaultLabels()

Build default labels by taking the level values.

buildDefaultLevels(*args)

Build default levels.

getAlpha()

Accessor to the alpha blending value of the Contour element.

getBoundingBox()

Accessor to the bounding box of the whole plot.

getCenter()

Accessor to the center of the Pie inside the bounding box.

getClassName()

Accessor to the object's name.

getColor()

Accessor to the color of the drawable element.

getColorBarPosition()

Accessor to the color position inside the graph containing the Contour element.

getColorCode()

Accessor to the code of the color of the drawable element.

getColorMap()

Accessor to the color map name of the Contour element.

getColorMapNorm()

Accessor to the normalization method of the Contour element.

getData()

Accessor to the data from which the Drawable is built.

getDrawLabels()

Accessor to the indication of data labels' presence within the drawable element.

getEdgeColor()

Accessor to the color of the Polygon edge.

getExtend()

Accessor to the filling mode of values that are outside the levels range of the Contour element.

getFillStyle()

Accessor to the fill style of the drawable element.

getHatches()

Accessor to the hatches used for filling the contour element.

getLabels()

Accessor to the labels of data.

getLegend()

Accessor to the legend of the drawable element.

getLevels()

Accessor to the levels of the Contour.

getLineStyle()

Accessor to the line style of the drawable element.

getLineWidth()

Accessor to the line width of the drawable element.

getName()

Accessor to the object's name.

getOrigin()

Accessor to the origin of the BarPlot.

getPalette()

Accessor to the names of the colors used for the Drawable.

getPaletteAsNormalizedRGBA()

Accessor to the Red, Green, Blue, Alpha components of the palette on a unit scale.

getPattern()

Accessor to the pattern of the Staircase.

getPointStyle()

Accessor to the point style of the drawable element.

getRadius()

Accessor to the radius of the Pie.

getTextAnnotations()

Accessor to the annotations of the Text.

getTextPositions()

Accessor to the position of annotations.

getTextSize()

Accessor to the text size.

getVmax()

Accessor to the vmax value of the Contour element.

getVmin()

Accessor to the vmin value of the Contour element.

getX()

Accessor to the first coordinate.

getY()

Accessor to the second coordinate.

hasName()

Test if the object is named.

isFilled()

Accessor to the isFilled flag of the Contour element.

isVmaxUsed()

Accessor to the flag isVmaxUsed of the Contour element.

isVminUsed()

Accessor to the flag isVminUsed of the Contour element.

setAlpha(alpha)

Accessor to the alpha blending value of the Contour element.

setCenter(center)

Accessor to the center of the Pie inside the bounding box.

setColor(color)

Accessor to the color of the drawable element.

setColorBarPosition(colorBarPosition)

Accessor to the color position inside the graph containing the Contour element.

setColorMap(colorMap)

Accessor to the name of the color map used to color the Contour element.

setColorMapNorm(norm)

Accessor to the normalization method of the Contour element.

setDrawLabels(drawLabels)

Accessor to the indication of data labels' presence within the drawable element.

setExtend(extend)

Accessor to the filling mode of values that are outside the levels range of the Contour element.

setFillStyle(fillStyle)

Accessor to the fill style of the drawable element.

setHatches(hatches)

Accessor to the hatches used for filling the contour element.

setIsFilled(isFilled)

Accessor to the flag isFilled of the Contour element.

setIsVmaxUsed(used)

Accessor to the flag isVmaxUsed of the Contour element.

setIsVminUsed(used)

Accessor to the flag isVminUsed of the Contour element.

setLabels(labels)

Accessor to the labels of data.

setLegend(legend)

Accessor to the legend of the drawable element.

setLevels(levels)

Accessor to the levels of the Contour.

setLineStyle(lineStyle)

Accessor to the line style of the drawable element.

setLineWidth(lineWidth)

Accessor to the line width of the drawable element.

setName(name)

Accessor to the object's name.

setOrigin(origin)

Accessor to the origin of the BarPlot.

setPalette(palette)

Accessor to the names of the colors used for the Pie.

setPattern(style)

Accessor to the pattern of the Staircase.

setPointStyle(pointStyle)

Accessor to the point style of the drawable element.

setRadius(radius)

Accessor to the radius of the Pie.

setTextAnnotations(textAnnotations)

Accessor to the annotations of the Text.

setTextPositions(textPositions)

Accessor to the position of annotations.

setTextSize(size)

Accessor to the text size.

setVmax(vmax)

Accessor to the vmax value of the Contour element.

setVmin(vmin)

Accessor to the vmin value of the Contour element.

setX(x)

Accessor to the first coordinate.

setY(y)

Accessor to the second coordinate.

__init__(*args)
static BuildDefaultPalette(size)

Build default palette.

Parameters:
nint n > 0

Number of colors needed.

Returns:
listColorsDescription

List of n color codes defined according to the default palette.

Notes

This function uses the ‘Drawable-DefaultPaletteName’ key of the ResourceMap, which can be equal to either ‘Tableau’ or ‘Rainbow’.

Examples

>>> import openturns as ot
>>> print(ot.Drawable().BuildDefaultPalette(4))
[#1f77b4,#ff7f0e,#2ca02c,#d62728]
>>> ot.ResourceMap.SetAsString('Drawable-DefaultPaletteName', 'Rainbow')
>>> print(ot.Drawable.BuildDefaultPalette(4))
[#ff0000,#ccff00,#00ff66,#0066ff]
>>> ot.ResourceMap.SetAsString('Drawable-DefaultPaletteName', 'Tableau')
>>> print(ot.Drawable.BuildDefaultPalette(4))
[#1f77b4,#ff7f0e,#2ca02c,#d62728]
>>> ot.ResourceMap.Reload()
static BuildRainbowPalette(size)

Build rainbow palette.

Parameters:
nint n > 0

Number of colors needed.

Returns:
listColorsDescription

List of n color codes defined according to the rainbow palette.

Notes

The colors are generated in the HSV space, with H (the hue) varying in a number of different values given by ‘Drawable-DefaultPalettePhase’ in ResourceMap and V (the value) being decreased linearly at each cycle of the hue.

Examples

>>> import openturns as ot
>>> print(ot.Drawable.BuildRainbowPalette(4))
[#ff0000,#ccff00,#00ff66,#0066ff]
static BuildTableauPalette(size)

Build tableau palette.

Parameters:
nint n > 0 and n < 10

Number of colors needed.

Returns:
listColorsDescription

List of n color codes defined according to the tableau palette.

Notes

The colors are generated in the HSV space. When the number of colors is greater than 10, the value V decreases linearily depending on the ‘Drawable-DefaultPalettePhase’ key of the ResourceMap for each block of 10 colors.

Examples

>>> import openturns as ot
>>> print(ot.Drawable.BuildTableauPalette(4))
[#1f77b4,#ff7f0e,#2ca02c,#d62728]
static ConvertFromHSV(hue, saturation, value)

Convert an HSV triplet to a valid hexadecimal code.

Parameters:
huefloat

Hue.

saturationfloat

Saturation.

valuefloat

Value.

Returns:
codestr

Hexadecimal code of the color.

static ConvertFromHSVA(hue, saturation, value, alpha)

Convert an HSVA quadruplet to a valid hexadecimal code.

Parameters:
huefloat

Hue.

saturationfloat

Saturation.

valuefloat

Value.

alphafloat

Alpha component.

Returns:
codestr

Hexadecimal code of the color.

static ConvertFromHSVIntoRGB(hue, saturation, value)

Convert an HSV triplet into an RGB triplet.

Parameters:
huefloat

Hue with 0<=hue<=360.

saturationfloat

Saturation with 0<=saturation<=1.

valuefloat

Value with 0<=value<=1.

Returns:
RGBComponentsPoint

RGB (Red, Green and Blue) components of the color.

Examples

>>> import openturns as ot
>>> print(ot.Drawable.ConvertFromHSVIntoRGB(215.0, 0.2, 0.3))
[0.24,0.265,0.3]
static ConvertFromName(name)

Convert a color name to a valid hexadecimal code.

Parameters:
namestr

Name of the color. The valid color names are given by the GetValidColors() method.

Returns:
codestr

Hexadecimal code of the color.

Examples

>>> import openturns as ot
>>> print(ot.Drawable.ConvertFromName('red'))
#FF0000
static ConvertFromRGB(*args)

Convert an RGB triplet to a valid hexadecimal code.

Parameters:
red, green and blueeither three nonnegative integers or three nonnegative floats

These values are the Red, Green and Blue components of a color, a value of 0 (or 0.0) meaning that the component is absent in the color, a value of 255 (or 1.0) meaning that the component is fully saturated.

Returns:
codestr

Hexadecimal code of the color.

Examples

>>> import openturns as ot
>>> print(ot.Drawable.ConvertFromRGB(255,0,0))
#ff0000
static ConvertFromRGBA(*args)

Convert an RGBA quadruplet to a valid hexadecimal code.

Parameters:
red, green and blueeither three nonnegative integers or three nonnegative floats

These values are the Red, Green and Blue components of a color, a value of 0 (or 0.0) meaning that the component is absent in the color, a value of 255 (or 1.0) meaning that the component is fully saturated.

alphaeither nonnegative integer or nonnegative float

Level of the color’s transparency, 0 (or 0.0) meaning that the color is fully transparent and 255 (or 1.0) meaning that the color is fully opaque. The alpha channel is only supported by a few devices, namely the PDF and PNG formats, for the other format the color is fully transparent as soon as its alpha channel is less than 255 (or 1.0).

Returns:
codestr

Hexadecimal code of the color.

Examples

>>> import openturns as ot
>>> print(ot.Drawable.ConvertFromRGBA(255,0,0,255))
#ff0000ff
static ConvertFromRGBIntoHSV(*args)

Convert an RGB triplet to HSV triplet.

Parameters:
redfloat

Red with 0<=red<=1.

greenfloat

Green with 0<=green<=1.

bluefloat

Blue with 0<=blue<=1.

Returns:
HSVComponentsPoint

HSV (hue, saturation and value) components of the color where 0<=hue<=360, 0<=saturation<=1, 0<=value<=255.

Examples

>>> import openturns as ot
>>> print(ot.Drawable.ConvertFromRGBIntoHSV(0.8, 0.6, 0.4))
[30,0.5,0.8]
static ConvertToRGB(key)

Convert an hexadecimal code into an RGB triplet.

Parameters:
codestr

Hexadecimal code of the color.

Returns:
RGBComponentsIndices

List containing the RGB (Red, Green and Blue) components of the color. A value of 0 meaning that the component is absent in the color, a value of 255 meaning that the component is fully saturated.

Examples

>>> import openturns as ot
>>> print(ot.Drawable.ConvertToRGB('#ff0000'))
[255,0,0]
static ConvertToRGBA(key)

Convert an hexadecimal code into an RGBA quadruplet.

Parameters:
codestr

Hexadecimal code of the color.

Returns:
RGBAComponentsIndices

List containing the RGB (Red, Green and Blue) components. A value of 0 meaning that the component is absent in the color, a value of 255 meaning that the component is fully saturated. It contains also alpha, the level of transparency of the color. Alpha equal to 0 meaning that the color is fully transparent and 255 meaning that the color is fully opaque.

Examples

>>> import openturns as ot
>>> print(ot.Drawable.ConvertToRGBA('#ff0000'))
[255,0,0,255]
static GetValidColorBarPositions()

Return the list of the valid color bar positions of contour drawables.

Returns:
validColorBarPositionsDescription

List of the valid color bar positions of contour drawables.

Examples

>>> import openturns as ot
>>> print(ot.Drawable.GetValidColorBarPositions())
[,left,right,top,bottom]
static GetValidColorMaps()

Return the list of the valid color maps of contour drawables.

Returns:
validColorMapsDescription

List of the valid color map names of contour drawables.

Examples

>>> import openturns as ot
>>> print(ot.Drawable.GetValidColorMaps()[:3])
[,magma,inferno]
static GetValidColors()

Return the list of the valid colors of the drawable element.

Returns:
validColorsDescription

List of the valid colors of the drawable element.

Examples

>>> import openturns as ot
>>> print(ot.Drawable.GetValidColors()[:5])
[aliceblue,antiquewhite,antiquewhite1,antiquewhite2,antiquewhite3]
static GetValidExtends()

Return the list of the valid coloration extends of contour drawables.

Returns:
validExtendsDescription

List of the valid coloration extends of contour drawables.

Examples

>>> import openturns as ot
>>> print(ot.Drawable.GetValidExtends())
[neither,both,min,max]
static GetValidFillStyles()

Return the list of the valid fill styles of the drawable element.

Returns:
validFillStylesDescription

List of the valid fill styles of the drawable element.

Examples

>>> import openturns as ot
>>> print(ot.Drawable.GetValidFillStyles()[:2])
[solid,shaded]
static GetValidLineStyles()

Return the list of the valid line styles of the drawable element.

Returns:
validLineStylesDescription

List of the valid line styles of the drawable element.

Examples

>>> import openturns as ot
>>> print(ot.Drawable.GetValidLineStyles())
[blank,solid,dashed,dotted,dotdash,longdash,twodash]
static GetValidNorms()

Return the list of the valid norms of contour drawables.

Returns:
validNormsDescription

List of the valid norms of contour drawables.

Notes

These norms are strings that can be passed as the norm parameter of a Matplotlib contour object, except rank which scales the colormap based on the ranks of the data values.

Examples

>>> import openturns as ot
>>> print(ot.Drawable.GetValidNorms())
[asinh,linear,log,logit,symlog,rank]
static GetValidPointStyles()

Return the list of the valid point styles of the drawable element.

Returns:
validPointStylesDescription

List of the valid point styles of the drawable element.

Examples

>>> import openturns as ot
>>> print(ot.Drawable().GetValidPointStyles())
[square,circle,triangleup,plus,times,...
buildDefaultLabels()

Build default labels by taking the level values.

buildDefaultLevels(*args)

Build default levels.

Parameters:
nint

Number of levels. If not specified, the default value is taken in the ResourceMap in the Contour-DefaultLevelsNumber key and n=10.

Notes

It builds n level values and the associated labels which are the level values. The level values are the empirical quantiles of the data to be sliced at orders q_k regularly distributed over ]0,1[: q_k = \frac{1}{n} \left( k+ \frac{1}{2} \right) for 0 \leq k \leq n-1.

getAlpha()

Accessor to the alpha blending value of the Contour element.

Returns:
alphafloat

The alpha blending value of the Contour element, between 0 (transparent) and 1 (opaque).

See also

setAlpha

Examples

>>> import openturns as ot
>>> print(ot.Contour(2,2,ot.Sample(4,1)).getAlpha())
1.0
getBoundingBox()

Accessor to the bounding box of the whole plot.

Returns:
boundingBoxInterval of dimension 2

Bounding box of the drawable element

getCenter()

Accessor to the center of the Pie inside the bounding box.

Returns:
centerPoint

Center of the Pie inside the bounding box.

getClassName()

Accessor to the object’s name.

Returns:
class_namestr

The object class name (object.__class__.__name__).

getColor()

Accessor to the color of the drawable element.

Returns:
colorstr

Name of the color of the lines within the drawable element. It can be either the name of a color (e.g. ‘red’) or an hexadecimal code corresponding to the RGB (Red, Green, Blue) components of the color (e.g. ‘#A1B2C3’) or the RGBA (Red, Green, Blue, Alpha) components of the color (e.g. ‘#A1B2C3D4’). The alpha channel is taken into account only by the PDF and PNG formats, for the other format the color is fully transparent as soon as its alpha channel is less than 255 (or 1.0). Use GetValidColors() for a list of available values.

Examples

>>> import openturns as ot
>>> print(ot.Drawable().getColor())
#1f77b4
getColorBarPosition()

Accessor to the color position inside the graph containing the Contour element.

Returns:
colorBarPositionstr

The name of the color bar position or ‘’ if the color bar should not be displayed.

Examples

>>> import openturns as ot
>>> contour = ot.Contour(2,2,ot.Sample(4,1))
>>> contour.setColorBarPosition('right')
>>> print(contour.getColorBarPosition())
right
getColorCode()

Accessor to the code of the color of the drawable element.

Returns:
colorstr

Hexadecimal code corresponding to the RGB (Red, Green, Blue) components of the color of the lines within the drawable element or the RGBA (Red, Green, Blue, Alpha) components of the color.

Examples

>>> import openturns as ot
>>> print(ot.Drawable().getColorCode())
#1f77b4
getColorMap()

Accessor to the color map name of the Contour element.

Returns:
colorMapstr

The name of the color map used to color the Contour element.

Examples

>>> import openturns as ot
>>> print(ot.Contour(2,2,ot.Sample(4,1)).getColorMap())
hsv
getColorMapNorm()

Accessor to the normalization method of the Contour element.

Returns:
normstr

The name of the normalization method used to scale scalar data to the [0, 1] range before mapping to colors using the color map.

Examples

>>> import openturns as ot
>>> print(ot.Contour(2,2,ot.Sample(4,1)).getColorMapNorm())
linear
getData()

Accessor to the data from which the Drawable is built.

Returns:
dataSample

Data from which the Drawable is built.

getDrawLabels()

Accessor to the indication of data labels’ presence within the drawable element.

Returns:
drawLabelsbool

True to draw the data labels, False to hide them.

getEdgeColor()

Accessor to the color of the Polygon edge.

Returns:
edgeColorstr

Color of the edge of the Polygon.

getExtend()

Accessor to the filling mode of values that are outside the levels range of the Contour element.

Returns:
extendstr

Determines the color filling of values that are outside the levels range. If ‘neither’, values outside the levels range are not colored. If ‘min’, ‘max’ or ‘both’, color the values below, above or below and above the levels range.

Examples

>>> import openturns as ot
>>> print(ot.Contour(2,2,ot.Sample(4,1)).getExtend())
both
getFillStyle()

Accessor to the fill style of the drawable element.

Returns:
fillStylestr

Fill style of the surfaces within the drawable element. Use GetValidFillStyles() for a list of available values.

Examples

>>> import openturns as ot
>>> print(ot.Drawable().getFillStyle())
solid
getHatches()

Accessor to the hatches used for filling the contour element.

Returns:
hatchesDescription

A list of cross hatch patterns to use on the filled areas. Hatches can use following characters : /|-+xoO.*

getLabels()

Accessor to the labels of data.

Returns:
labelsDescription

Describes the data within the drawable element.

getLegend()

Accessor to the legend of the drawable element.

Returns:
legendstr

Legend of the drawable element.

getLevels()

Accessor to the levels of the Contour.

Returns:
levelsPoint

Different levels where the iso-curves of the Contour will be drawn.

Notes

If two points of the grid have values bracketing the level, a linear interpolation is made in order to find the point associated to the level considered.

getLineStyle()

Accessor to the line style of the drawable element.

Returns:
lineStylestr

Style of the line within the drawable element. Use GetValidLineStyles() for a list of available values.

Examples

>>> import openturns as ot
>>> print(ot.Drawable().getLineStyle())
solid
getLineWidth()

Accessor to the line width of the drawable element.

Returns:
lineWidthfloat

Width of the line within the drawable element.

getName()

Accessor to the object’s name.

Returns:
namestr

The name of the object.

getOrigin()

Accessor to the origin of the BarPlot.

Returns:
originfloat

Value where the BarPlot begins.

getPalette()

Accessor to the names of the colors used for the Drawable.

Returns:
paletteDescription

Names of the colors used for the Drawable. It can be either the name of a color (e.g. ‘red’) or an hexadecimal code corresponding to the RGB (Red, Green, Blue) components of the color (e.g. ‘#A1B2C3’) or the RGBA (Red, Green, Blue, Alpha) components of the color (e.g. ‘#A1B2C3D4’).

getPaletteAsNormalizedRGBA()

Accessor to the Red, Green, Blue, Alpha components of the palette on a unit scale.

Returns:
normalizedRGBAPaletteSample

Sample of the four components of each color of the palette on a unit [0,1] scale.

getPattern()

Accessor to the pattern of the Staircase.

Returns:
patternstr

Pattern of the Staircase which is ‘S’ or ‘s’. By default the pattern is equal to ‘s’. Going from (x_1, y_1) to (x_2, y_2) with x_1<x_2, pattern=’s’ moves first horizontal then vertical, whereas pattern=’S’ moves the other way around.

getPointStyle()

Accessor to the point style of the drawable element.

Returns:
pointStylestr

Style of the points within the drawable element. Use :meth:GetValidPointStyles for a list of available values.

Examples

>>> import openturns as ot
>>> print(ot.Drawable().getPointStyle())
none
getRadius()

Accessor to the radius of the Pie.

Returns:
radiusfloat

Radius of the Pie.

getTextAnnotations()

Accessor to the annotations of the Text.

Returns:
annotationsDescription

Accessor to text annotations.

getTextPositions()

Accessor to the position of annotations.

Returns:
positionsIndices

Accessor to text position with respect to data coordinates. Text is written below (position=1), above (position=3), to the left (position=2) or to the right (position=4) of data coordinates.

getTextSize()

Accessor to the text size.

Returns:
sizefloat

Size of the Text.

Notes

The default value is 0.75.

getVmax()

Accessor to the vmax value of the Contour element.

Returns:
vmaxfloat

The vmax value of the Contour element.

See also

setVmax

Examples

>>> import openturns as ot
>>> contour = ot.Contour(2,2,ot.Sample(4,1))
>>> contour.setVmax(5.0)
>>> print(contour.getVmax())
5.0
getVmin()

Accessor to the vmin value of the Contour element.

Returns:
vminfloat

The vmin value of the Contour element.

See also

setVmin

Examples

>>> import openturns as ot
>>> contour = ot.Contour(2,2,ot.Sample(4,1))
>>> contour.setVmin(5.0)
>>> print(contour.getVmin())
5.0
getX()

Accessor to the first coordinate.

Returns:
firstCoordSample

Values of the first coordinate.

getY()

Accessor to the second coordinate.

Returns:
secondCoordSample

Values of the second coordinate.

hasName()

Test if the object is named.

Returns:
hasNamebool

True if the name is not empty.

isFilled()

Accessor to the isFilled flag of the Contour element.

Returns:
isFilledbool

True if the iso-curves must be filled.

See also

setIsFilled

Examples

>>> import openturns as ot
>>> print(ot.Contour(2,2,ot.Sample(4,1)).isFilled())
False
isVmaxUsed()

Accessor to the flag isVmaxUsed of the Contour element.

Returns:
isVmaxUsedbool

The flag isVmaxUsed of the Contour element.

See also

setIsVmaxUsed

Examples

>>> import openturns as ot
>>> contour = ot.Contour(2,2,ot.Sample(4,1))
>>> print(contour.isVmaxUsed())
False
isVminUsed()

Accessor to the flag isVminUsed of the Contour element.

Returns:
isVminUsedbool

The flag isVminUsed of the Contour element.

See also

setIsVminUsed

Examples

>>> import openturns as ot
>>> contour = ot.Contour(2,2,ot.Sample(4,1))
>>> print(contour.isVminUsed())
False
setAlpha(alpha)

Accessor to the alpha blending value of the Contour element.

Parameters:
alphafloat

The alpha blending value of the Contour element, between 0 (transparent) and 1 (opaque).

See also

getAlpha
setCenter(center)

Accessor to the center of the Pie inside the bounding box.

Parameters:
centersequence of float

Center of the Pie inside the bounding box.

setColor(color)

Accessor to the color of the drawable element.

Parameters:
colorstr

Describes the color of the lines within the drawable element. It can be either the name of a color (e.g. ‘red’) or an hexadecimal code corresponding to the RGB (Red, Green, Blue) components of the color (e.g. ‘#A1B2C3’) or the RGBA (Red, Green, Blue, Alpha) components of the color (e.g. ‘#A1B2C3D4’). The alpha channel is taken into account only by the PDF and PNG formats, for the other format the color is fully transparent as soon as its alpha channel is less than 255 (or 1.0). Use GetValidColors() for a list of available values.

setColorBarPosition(colorBarPosition)

Accessor to the color position inside the graph containing the Contour element.

Parameters:
colorBarPositionstr

The name of the color bar position or ‘’ if the color bar should not be displayed.

setColorMap(colorMap)

Accessor to the name of the color map used to color the Contour element.

Parameters:
colorMapstr

The name of the color map used to color the Contour element. Use GetValidColorMaps() for a list of available values.

setColorMapNorm(norm)

Accessor to the normalization method of the Contour element.

Parameters:
normstr

The name of the normalization method used to scale scalar data to the [0, 1] range before mapping to colors using the color map. Use GetValidNorms() for a list of available values.

setDrawLabels(drawLabels)

Accessor to the indication of data labels’ presence within the drawable element.

Parameters:
drawLabelsbool

True to draw the data labels, False to hide them.

setExtend(extend)

Accessor to the filling mode of values that are outside the levels range of the Contour element.

Parameters:
extendstr

Determines the color filling of values that are outside the levels range. If ‘neither’, values outside the levels range are not colored. If ‘min’, ‘max’ or ‘both’, color the values below, above or below and above the levels range. Use GetValidExtends() for a list of available values.

setFillStyle(fillStyle)

Accessor to the fill style of the drawable element.

Parameters:
fillStylestr

Fill style of the surfaces within the drawable element. Use GetValidFillStyles() for a list of available values.

setHatches(hatches)

Accessor to the hatches used for filling the contour element.

Parameters:
hatchessequence of str

A list of cross hatch patterns to use on the filled areas. Hatches can use following characters : /|-+xoO.*

setIsFilled(isFilled)

Accessor to the flag isFilled of the Contour element.

Parameters:
isFilledbool

True if the iso-curves must be filled.

See also

isFilled
setIsVmaxUsed(used)

Accessor to the flag isVmaxUsed of the Contour element.

Parameters:
usedbool

The flag isVmaxUsed of the Contour element.

See also

isVmaxUsed
setIsVminUsed(used)

Accessor to the flag isVminUsed of the Contour element.

Parameters:
usedbool

The flag isVminUsed of the Contour element.

See also

isVminUsed
setLabels(labels)

Accessor to the labels of data.

Parameters:
labelssequence of str

Describes the data within the drawable element.

setLegend(legend)

Accessor to the legend of the drawable element.

Parameters:
legendstr

Legend of the drawable element.

setLevels(levels)

Accessor to the levels of the Contour.

Parameters:
levelssequence of float

Different levels where the iso-curves of the Contour will be drawn.

Notes

If two points of the grid have values bracketing the level, a linear interpolation is made in order to find the point associated to the level considered.

setLineStyle(lineStyle)

Accessor to the line style of the drawable element.

Parameters:
lineStylestr

Style of the line within the drawable element. Use GetValidLineStyles() for a list of available values.

setLineWidth(lineWidth)

Accessor to the line width of the drawable element.

Parameters:
lineWidthpositive float

Width of the line within the drawable element.

setName(name)

Accessor to the object’s name.

Parameters:
namestr

The name of the object.

setOrigin(origin)

Accessor to the origin of the BarPlot.

Parameters:
originfloat

Value where the BarPlot begins.

setPalette(palette)

Accessor to the names of the colors used for the Pie.

Parameters:
palettesequence of str

Names of the colors used for the Pie. It can be either the name of a color (e.g. ‘red’) or an hexadecimal code corresponding to the RGB (Red, Green, Blue) components of the color (e.g. ‘#A1B2C3’) or the RGBA (Red, Green, Blue, Alpha) components of the color (e.g. ‘#A1B2C3D4’). Use GetValidColors() for a list of available values.

setPattern(style)

Accessor to the pattern of the Staircase.

Parameters:
patternstr

Pattern of the Staircase which is ‘S’ or ‘s’. By default the pattern is equal to ‘s’. Going from (x_1, y_1) to (x_2, y_2) with x_1<x_2, pattern=’s’ moves first horizontal then vertical, whereas pattern=’S’ moves the other way around.

setPointStyle(pointStyle)

Accessor to the point style of the drawable element.

Parameters:
pointStylestr

Style of the points within the drawable element. Use GetValidPointStyles() for a list of available values.

setRadius(radius)

Accessor to the radius of the Pie.

Parameters:
radiusfloat

Radius of the Pie.

setTextAnnotations(textAnnotations)

Accessor to the annotations of the Text.

Parameters:
annotationsDescription

Accessor to text annotations.

setTextPositions(textPositions)

Accessor to the position of annotations.

Parameters:
positionsIndices

Accessor to text position with respect to data coordinates. Text is written below (position=1), above (position=3), to the left (position=2) or to the right (position=4) of data coordinates.

setTextSize(size)

Accessor to the text size.

Parameters:
sizefloat

Size of the Text.

Notes

The default value is 0.75.

setVmax(vmax)

Accessor to the vmax value of the Contour element.

Parameters:
vmaxfloat

The vmax value of the Contour element.

See also

getVmax
setVmin(vmin)

Accessor to the vmin value of the Contour element.

Parameters:
vminfloat

The vmin value of the Contour element.

See also

getVmin
setX(x)

Accessor to the first coordinate.

Parameters:
firstCoord2-d sequence of float

Values of the first coordinate.

setY(y)

Accessor to the second coordinate.

Parameters:
secondCoord2-d sequence of float

Values of the second coordinate.

Examples using the class

Draw minimum volume level sets

Draw minimum volume level sets

Kriging: metamodel of the Branin-Hoo function

Kriging: metamodel of the Branin-Hoo function

Use the FORM algorithm in case of several design points

Use the FORM algorithm in case of several design points

Create a domain event

Create a domain event

An illustrated example of a FORM probability estimate

An illustrated example of a FORM probability estimate

Cross Entropy Importance Sampling

Cross Entropy Importance Sampling

Example of sensitivity analyses on the wing weight model

Example of sensitivity analyses on the wing weight model

Customize your Metropolis-Hastings algorithm

Customize your Metropolis-Hastings algorithm

Plot the log-likelihood contours of a distribution

Plot the log-likelihood contours of a distribution

A quick start guide to contours

A quick start guide to contours