MatthewReid854/reliability

[BUG] - Problem with matplotlib-3.7.0

Closed this issue · 1 comments

Example1 for Fitting a specific distribution to data
succeed with packages below;

reliability==0.8.7
matplotlib==3.6.1

% python
Python 3.11.2 (v3.11.2:878ead1ac1, Feb  7 2023, 10:02:41) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from reliability.Fitters import Fit_Weibull_2P
>>> import matplotlib.pyplot as plt
>>> data = [58,75,36,52,63,65,22,17,28,64,23,40,73,45,52,36,52,60,13,55,82,55,34,57,23,42,66,35,34,25] # made using Weibull Distribution(alpha=50,beta=3)
>>> wb = Fit_Weibull_2P(failures=data)
Results from Fit_Weibull_2P (95% CI):
Analysis method: Maximum Likelihood Estimation (MLE)
Optimizer: TNC
Failures / Right censored: 30/0 (0% right censored) 

Parameter  Point Estimate  Standard Error  Lower CI  Upper CI
    Alpha          51.858         3.55628   45.3359   59.3183
     Beta         2.80086         0.41411   2.09624   3.74233 

Goodness of fit    Value
 Log-likelihood -129.063
           AICc   262.57
            BIC  264.928
             AD 0.759805 

>>> plt.show()

plot0

But, when I uninstall matplotlib and reliability, then install them again as below,

% pip uninstall matplotlib reliability
Successfully uninstalled matplotlib-3.6.1
Successfully uninstalled reliability-0.8.7
% pip install matplotlib reliability
Collecting matplotlib
  Using cached matplotlib-3.7.0-cp311-cp311-macosx_10_12_x86_64.whl (7.4 MB)
Collecting reliability
  Using cached reliability-0.8.7-py3-none-any.whl (256 kB)
Requirement already satisfied: contourpy>=1.0.1 in ./l3aa/lib/python3.11/site-packages (from matplotlib) (1.0.7)
Requirement already satisfied: cycler>=0.10 in ./l3aa/lib/python3.11/site-packages (from matplotlib) (0.11.0)
Requirement already satisfied: fonttools>=4.22.0 in ./l3aa/lib/python3.11/site-packages (from matplotlib) (4.38.0)
Requirement already satisfied: kiwisolver>=1.0.1 in ./l3aa/lib/python3.11/site-packages (from matplotlib) (1.4.4)
Requirement already satisfied: numpy>=1.20 in ./l3aa/lib/python3.11/site-packages (from matplotlib) (1.24.2)
Requirement already satisfied: packaging>=20.0 in ./l3aa/lib/python3.11/site-packages (from matplotlib) (23.0)
Requirement already satisfied: pillow>=6.2.0 in ./l3aa/lib/python3.11/site-packages (from matplotlib) (9.4.0)
Requirement already satisfied: pyparsing>=2.3.1 in ./l3aa/lib/python3.11/site-packages (from matplotlib) (3.0.9)
Requirement already satisfied: python-dateutil>=2.7 in ./l3aa/lib/python3.11/site-packages (from matplotlib) (2.8.2)
Requirement already satisfied: autograd>=1.3 in ./l3aa/lib/python3.11/site-packages (from reliability) (1.5)
Requirement already satisfied: scipy>=1.7.0 in ./l3aa/lib/python3.11/site-packages (from reliability) (1.10.1)
Requirement already satisfied: pandas>=1.1.2 in ./l3aa/lib/python3.11/site-packages (from reliability) (1.5.3)
Requirement already satisfied: autograd-gamma>=0.5.0 in ./l3aa/lib/python3.11/site-packages (from reliability) (0.5.0)
Requirement already satisfied: mplcursors>=0.3 in ./l3aa/lib/python3.11/site-packages (from reliability) (0.5.2)
Requirement already satisfied: docutils<0.18 in ./l3aa/lib/python3.11/site-packages (from reliability) (0.17.1)
Requirement already satisfied: future>=0.15.2 in ./l3aa/lib/python3.11/site-packages (from autograd>=1.3->reliability) (0.18.3)
Requirement already satisfied: pytz>=2020.1 in ./l3aa/lib/python3.11/site-packages (from pandas>=1.1.2->reliability) (2022.7.1)
Requirement already satisfied: six>=1.5 in ./l3aa/lib/python3.11/site-packages (from python-dateutil>=2.7->matplotlib) (1.16.0)
Installing collected packages: matplotlib, reliability
Successfully installed matplotlib-3.7.0 reliability-0.8.7
% pip freeze
appnope==0.1.3
asttokens==2.2.1
autograd==1.5
autograd-gamma==0.5.0
backcall==0.2.0
contourpy==1.0.7
cycler==0.11.0
decorator==5.1.1
docutils==0.17.1
executing==1.2.0
fonttools==4.38.0
future==0.18.3
ipython==8.10.0
jedi==0.18.2
kiwisolver==1.4.4
matplotlib==3.7.0
matplotlib-inline==0.1.6
mplcursors==0.5.2
numpy==1.24.2
packaging==23.0
pandas==1.5.3
parso==0.8.3
pexpect==4.8.0
pickleshare==0.7.5
Pillow==9.4.0
prompt-toolkit==3.0.36
ptyprocess==0.7.0
pure-eval==0.2.2
Pygments==2.14.0
pyparsing==3.0.9
python-dateutil==2.8.2
pytz==2022.7.1
reliability==0.8.7
scipy==1.10.1
six==1.16.0
stack-data==0.6.2
traitlets==5.9.0
wcwidth==0.2.6

Example1 for Fitting a specific distribution to data fails with error and fit line is not drawn in plot while "Results from Fit_Weibull_2P" comes out.

% python
Python 3.11.2 (v3.11.2:878ead1ac1, Feb  7 2023, 10:02:41) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from reliability.Fitters import Fit_Weibull_2P
>>> import matplotlib.pyplot as plt
>>> data = [58,75,36,52,63,65,22,17,28,64,23,40,73,45,52,36,52,60,13,55,82,55,34,57,23,42,66,35,34,25] # made using Weibull Distribution(alpha=50,beta=3)
>>> wb = Fit_Weibull_2P(failures=data)
Results from Fit_Weibull_2P (95% CI):
Analysis method: Maximum Likelihood Estimation (MLE)
Optimizer: TNC
Failures / Right censored: 30/0 (0% right censored) 

Parameter  Point Estimate  Standard Error  Lower CI  Upper CI
    Alpha          51.858         3.55628   45.3359   59.3183
     Beta         2.80086         0.41411   2.09624   3.74233 

Goodness of fit    Value
 Log-likelihood -129.063
           AICc   262.57
            BIC  264.928
             AD 0.759805 

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/hyakutakeshinkoku/l3aa/lib/python3.11/site-packages/reliability/Fitters.py", line 2333, in __init__
    Weibull_probability_plot(
  File "/Users/hyakutakeshinkoku/l3aa/lib/python3.11/site-packages/reliability/Probability_plotting.py", line 373, in Weibull_probability_plot
    plt.grid(b=True, which="major", color="k", alpha=0.3, linestyle="-")
  File "/Users/hyakutakeshinkoku/l3aa/lib/python3.11/site-packages/matplotlib/pyplot.py", line 2589, in grid
    return gca().grid(visible=visible, which=which, axis=axis, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/hyakutakeshinkoku/l3aa/lib/python3.11/site-packages/matplotlib/axes/_base.py", line 3196, in grid
    self.xaxis.grid(visible, which=which, **kwargs)
  File "/Users/hyakutakeshinkoku/l3aa/lib/python3.11/site-packages/matplotlib/axis.py", line 1655, in grid
    self.set_tick_params(which='major', **gridkw)
  File "/Users/hyakutakeshinkoku/l3aa/lib/python3.11/site-packages/matplotlib/axis.py", line 927, in set_tick_params
    kwtrans = self._translate_tick_params(kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/hyakutakeshinkoku/l3aa/lib/python3.11/site-packages/matplotlib/axis.py", line 1071, in _translate_tick_params
    raise ValueError(
ValueError: keyword grid_b is not recognized; valid keywords are ['size', 'width', 'color', 'tickdir', 'pad', 'labelsize', 'labelcolor', 'zorder', 'gridOn', 'tick1On', 'tick2On', 'label1On', 'label2On', 'length', 'direction', 'left', 'bottom', 'right', 'top', 'labelleft', 'labelbottom', 'labelright', 'labeltop', 'labelrotation', 'grid_agg_filter', 'grid_alpha', 'grid_animated', 'grid_antialiased', 'grid_clip_box', 'grid_clip_on', 'grid_clip_path', 'grid_color', 'grid_dash_capstyle', 'grid_dash_joinstyle', 'grid_dashes', 'grid_data', 'grid_drawstyle', 'grid_figure', 'grid_fillstyle', 'grid_gapcolor', 'grid_gid', 'grid_in_layout', 'grid_label', 'grid_linestyle', 'grid_linewidth', 'grid_marker', 'grid_markeredgecolor', 'grid_markeredgewidth', 'grid_markerfacecolor', 'grid_markerfacecoloralt', 'grid_markersize', 'grid_markevery', 'grid_mouseover', 'grid_path_effects', 'grid_picker', 'grid_pickradius', 'grid_rasterized', 'grid_sketch_params', 'grid_snap', 'grid_solid_capstyle', 'grid_solid_joinstyle', 'grid_transform', 'grid_url', 'grid_visible', 'grid_xdata', 'grid_ydata', 'grid_zorder', 'grid_aa', 'grid_c', 'grid_ds', 'grid_ls', 'grid_lw', 'grid_mec', 'grid_mew', 'grid_mfc', 'grid_mfcalt', 'grid_ms']
>>> plt.show()

plot1

pip check do not raise any warnings.

% pip check
No broken requirements found.

So far, I can succeed Example1 for Fitting a specific distribution to data by installing matplotlib 3.6.1 and I do not have inconvenience about that, but this problem with matplotlib-3.7.0 might be confusing.

% pip install "matplotlib==3.6.1"   
Collecting matplotlib==3.6.1
  Using cached matplotlib-3.6.1-cp311-cp311-macosx_10_12_x86_64.whl (7.3 MB)
Requirement already satisfied: contourpy>=1.0.1 in ./l3aa/lib/python3.11/site-packages (from matplotlib==3.6.1) (1.0.7)
Requirement already satisfied: cycler>=0.10 in ./l3aa/lib/python3.11/site-packages (from matplotlib==3.6.1) (0.11.0)
Requirement already satisfied: fonttools>=4.22.0 in ./l3aa/lib/python3.11/site-packages (from matplotlib==3.6.1) (4.38.0)
Requirement already satisfied: kiwisolver>=1.0.1 in ./l3aa/lib/python3.11/site-packages (from matplotlib==3.6.1) (1.4.4)
Requirement already satisfied: numpy>=1.19 in ./l3aa/lib/python3.11/site-packages (from matplotlib==3.6.1) (1.24.2)
Requirement already satisfied: packaging>=20.0 in ./l3aa/lib/python3.11/site-packages (from matplotlib==3.6.1) (23.0)
Requirement already satisfied: pillow>=6.2.0 in ./l3aa/lib/python3.11/site-packages (from matplotlib==3.6.1) (9.4.0)
Requirement already satisfied: pyparsing>=2.2.1 in ./l3aa/lib/python3.11/site-packages (from matplotlib==3.6.1) (3.0.9)
Requirement already satisfied: python-dateutil>=2.7 in ./l3aa/lib/python3.11/site-packages (from matplotlib==3.6.1) (2.8.2)
Requirement already satisfied: six>=1.5 in ./l3aa/lib/python3.11/site-packages (from python-dateutil>=2.7->matplotlib==3.6.1) (1.16.0)
Installing collected packages: matplotlib
  Attempting uninstall: matplotlib
    Found existing installation: matplotlib 3.7.0
    Uninstalling matplotlib-3.7.0:
      Successfully uninstalled matplotlib-3.7.0
Successfully installed matplotlib-3.6.1

macOS 13.1
Intel Core i5
Python 3.11.2

Fixed in v0.8.8. Thanks for reporting this.