draw_critical_values#
- pycafee.normalitycheck.shapirowilk.ShapiroWilk.draw_critical_values(self, ax=None, export=None, extension=None, file_name=None, dpi=None, decimal_separator=None)#
Draw a plot with the Shapiro Wilk critical data [1].
- Parameters
- ax
Noneormatplotlib.axes.SubplotBase If
axisNone, a figure is created with a preset design. The other parameters can be used to export the graph.If
axis amatplotlib.axes.SubplotBase, the function returns amatplotlib.axes.SubplotBasewith the Shapiro Wilk critical data. In this case, the other parameters do not affect the graph.
- export
bool, optional Whether the graph should be exported (
True) or not (False). The default value isNone, which impliesFalse.- file_name
str, optional The file name. Default is
Nonewhich results in a file named"shapiro_wilk_critical_plot".- extension
str, optional The file extension without a dot. Default is
Nonewhich results in a".png"file.- dpi
intorfloat, optional The figure pixel density. The default is
None, which results in a100 dpispicture. This parameter must be a number higher than zero.- decimal_separator
str, optional The decimal separator symbol used in the chart. It can be the dot (
Noneor'.') or the comma (',').
- ax
- Returns
- axes
matplotlib.axes._subplots.AxesSubplot The axis of the graph.
- axes
See also
get_critical_valueReturns the critical value.
fitperforms the Shapiro Wilk Normality test.
Notes
To obtain the tabulated values of the Kolmogorov Smirnov test, use:
>>> from pycafee.normalitycheck.shapirowilk import ShapiroWilk >>> sw_test = ShapiroWilk() >>> SW_TABLE = sw_test.SHAPIRO_WILK_TABLE >>> print(SW_TABLE)
References
- 1
SHAPIRO, S. S.; WILK, M. B. An Analysis of Variance Test for Normality (Complete Samples). Biometrika, v. 52, n. 3, p. 591–611, 1965. DOI: 10.2307/2333709.
Examples
Using the figure created inside the function
>>> from pycafee.normalitycheck.shapirowilk import ShapiroWilk >>> sw_test = ShapiroWilk() >>> ax = sw_test.draw_critical_values(export=True) The 'shapiro_wilk_critical_plot.png' file has been exported
Using a previously created figure
>>> from pycafee.normalitycheck.shapirowilk import ShapiroWilk >>> import matplotlib.pyplot as plt >>> sw_test = ShapiroWilk(language='pt-br') >>> fig, ax = plt.subplots(figsize=(8,6)) >>> ax = sw_test.draw_critical_values(ax=ax) >>> plt.savefig("sw_plot.png") >>> plt.show()