plot_points
- class reliability.Probability_plotting.plot_points(failures=None, right_censored=None, func='CDF', a=None, downsample_scatterplot=False, **kwargs)
Plots the failure points as a scatter plot based on the plotting positions. This is similar to a probability plot, just without the axes scaling or the fitted distribution. It may be used to overlay the failure points with a fitted distribution on either the PDF, CDF, SF, HF, or CHF. If you choose to plot the points for PDF or HF the points will not form a smooth curve as this process requires integration of discrete points which leads to a discontinuous plot. The PDF and HF points are correct but not as useful as CDF, SF, and CHF.
- Parameters:
failures (array, list) – The failure times. Minimum number of points allowed is 1.
right_censored (array, list, optional) – The right censored failure times. Optional input.
func (str) – The distribution function to plot. Choose either ‘PDF,’CDF’,’SF’,’HF’, or ‘CHF’. Default = ‘CDF’.
a (float, int) – The heuristic constant for plotting positions of the form (k-a)/(n+1-2a). Default is a=0.3 which is the median rank method (same as the default in Minitab). For more heuristics, see: https://en.wikipedia.org/wiki/Q%E2%80%93Q_plot#Heuristics
downsample_scatterplot (bool, int, optional) – If True or None, and there are over 1000 points, then the scatterplot will be downsampled by a factor. The default downsample factor will seek to produce between 500 and 1000 points. If a number is specified, it will be used as the downsample factor. Default is False which will result in no downsampling. This functionality makes plotting faster when there are very large numbers of points. It only affects the scatterplot not the calculations.
kwargs – Keyword arguments for the scatter plot. Defaults are set for color=’k’ and marker=’.’ These defaults can be changed using kwargs.
- Returns:
None
Notes
It is recommended that plot_points be used in conjunction with one of the plotting methods from a distribution (see the example below).
from reliability.Fitters import Fit_Lognormal_2P from reliability.Probability_plotting import plot_points import matplotlib.pyplot as plt data = [8.0, 10.2, 7.1, 5.3, 8.5, 15.4, 17.7, 5.4, 5.8, 11.7, 4.4, 18.1, 8.5, 6.6, 9.7, 13.7, 8.2, 15.3, 2.9, 4.3] fitted_dist = Fit_Lognormal_2P(failures=data,show_probability_plot=False,print_results=False) #fit the Lognormal distribution to the failure data plot_points(failures=data,func='SF') #plot the failure points on the scatter plot fitted_dist.distribution.SF() #plot the distribution plt.show()