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([1.0, 2.0, 3.0]): 9 distribution = ot.WeibullMax(1.0, p, 0.0) 10 pdf_curve = distribution.drawPDF().getDrawable(0) 11 cdf_curve = distribution.drawCDF().getDrawable(0) 12 pdf_curve.setColor(palette[i]) 13 cdf_curve.setColor(palette[i]) 14 pdf_curve.setLegend('alpha={}'.format(p)) 15 cdf_curve.setLegend('alpha={}'.format(p)) 16 pdf_graph.add(pdf_curve) 17 cdf_graph.add(cdf_curve) 18fig = plt.figure(figsize=(10, 4)) 19pdf_axis = fig.add_subplot(121) 20cdf_axis = fig.add_subplot(122) 21View(pdf_graph, figure=fig, axes=[pdf_axis], add_legend=True) 22View(cdf_graph, figure=fig, axes=[cdf_axis], add_legend=True) 23fig.suptitle('WeibullMax(1,alpha,0)') 24