1import openturns as ot 2from matplotlib import pyplot as plt 3from openturns.viewer import View 4 5pdf_graph = ot.Graph('PDF graph', 'x', 'PDF', True, 'topleft') 6cdf_graph = ot.Graph('CDF graph', 'x', 'CDF', True, 'topleft') 7palette = ot.Drawable.BuildDefaultPalette(10) 8for i, p in enumerate([(0.5, 0.5), (5, 1), (1, 3), (2, 2), (2, 5)]): 9 alpha, beta = p 10 distribution = ot.Beta(alpha, beta, -1.0, 1.0) 11 pdf_curve = distribution.drawPDF().getDrawable(0) 12 cdf_curve = distribution.drawCDF().getDrawable(0) 13 pdf_curve.setColor(palette[i]) 14 cdf_curve.setColor(palette[i]) 15 pdf_curve.setLegend('alpha,beta={},{}'.format(alpha, beta)) 16 cdf_curve.setLegend('alpha,beta={},{}'.format(alpha, beta)) 17 pdf_graph.add(pdf_curve) 18 cdf_graph.add(cdf_curve) 19fig = plt.figure(figsize=(10, 4)) 20pdf_axis = fig.add_subplot(121) 21cdf_axis = fig.add_subplot(122) 22View(pdf_graph, figure=fig, axes=[pdf_axis], add_legend=True) 23View(cdf_graph, figure=fig, axes=[cdf_axis], add_legend=True) 24fig.suptitle('Beta(alpha,beta,-1,1)') 25