I am working on the Weibull distribution. I've estimated the parameters for my data and I've got the probability plot. As seen in the code bellow, on the probability plot I have 'pasted' the parameter values that I obtained.
But, is there any other way to attach them to the plot?
Another question is: how can I get a plot with the probability of non-exceedance on axis 'x' and the variable on axis 'y', which, in turn, includes the weibull adjustment with the three parameters. The plot I'm looking for is like this (or similar).
The code in python I wrote is the next:
from matplotlib import pyplot as plt import pandas as pd import numpy as np plt.style.use('classic') %matplotlib inline import seaborn as sns from scipy.stats import exponweib, probplot as pp, weibull_min import probscale from probscale.viz import probplot as pp_scale, plot_pos import statsmodels.distributions from scipy.optimize import fmin import statsmodels.api as sm datos = pd.read_csv('01_ATN_ACCE_his_1985_2005.csv') Hs = datos['Hs'] plt.hist(Hs, density = True, alpha = 0.5, bins=45) shape, loc, scale = weibull_min.fit(Hs) x = np.linspace(Hs.min(), Hs.max(), 500) plt.plot(x, weibull_min(shape, loc, scale).pdf(x)) plt.xlabel("Hs (m)") plt.ylabel("%") plt.title("Ajuste Weibull sobre Hs") fig, ax= plt.subplots(figsize=(12,6)) pp(Hs, dist = weibull_min(shape, loc, scale), fit=True, plot=ax, rvalue=True) plt.text(0.5,7,'A=', fontsize=14) plt.text(0.7,7,'{0:.2f}'.format(scale), fontsize=14) plt.text(0.5, 6.5, 'B=', fontsize=14) plt.text(0.7,6.5,'{0:.2f}'.format(loc), fontsize=14) plt.text(0.5, 6, 'C=', fontsize=14) plt.text(0.7,6,'{0:.2f}'.format(shape), fontsize=14) ax.get_children()[2].set_fontsize(14) ax.get_children()[2].set_position((0.5,5.5)) https://stackoverflow.com/questions/66705076/weibull-non-exceedance-plot-axis-x March 19, 2021 at 04:51PM
没有评论:
发表评论