1import openturns as ot 2from matplotlib import pyplot as plt 3from openturns.viewer import View 4from math import sin, pi 5 6# Generate the data for the curves to be drawn 7data = [ 8 [-3 * pi + 6 * pi * i / 100, sin(-3 * pi + 6 * pi * i / 100)] for i in range(100)] 9 10# Create an empty graph 11graph = ot.Graph("Curve example", "x", "sin(x)", True, "") 12 13# Create the curve 14curve = ot.Curve(data, "blue", "solid", 2, "") 15 16# Then, draw it 17graph.add(curve) 18 19fig = plt.figure(figsize=(6, 4)) 20axis = fig.add_subplot(111) 21axis.set_xlim(auto=True) 22View(graph, figure=fig, axes=[axis], add_legend=False) 23