Visualize cobwebΒΆ

In this example we are going to display a CobWeb plot from samples of X/Y data.

In [1]:
from __future__ import print_function
import openturns as ot
In [2]:
# Create data to visualize
size = 100
inputDimension = 6
inputSample = ot.Normal(inputDimension).getSample(size)
inputVar = [None]*inputDimension
for i in range(inputDimension):
    inputVar[i] = 'X' + str(i)
inputSample.setDescription(inputVar)
formula = ot.Description(1)
expression = ''
for i in range(inputDimension):
    if i > 0:
        expression += '+'
    expression += 'cos(' + str(i + 1) + '*' + inputVar[i] + ')'
formula[0] = expression
model = ot.SymbolicFunction(inputVar, formula)
outputSample = model(inputSample)
In [3]:
# Draw CobWeb
graphCobweb = ot.VisualTest.DrawCobWeb(inputSample, outputSample, 1.0, 2.0, 'red', False)
graphCobweb.setLegendPosition('topleft')
graphCobweb
Out[3]:
../../_images/examples_data_analysis_visualize_cobweb_4_0.svg