openturns/otpod

POGGauss.drawPOD() issue

Closed this issue · 4 comments

Tried to trace this back, but there seems to be an incompatibility with matplotlib (installed version 3.7.1). The following error occurs when running linearPOD.ipnyb example. Hope you know what's going on?

Thanks


ValueError Traceback (most recent call last)
Input In [10], in <cell line: 1>()
----> 1 fig, ax = PODGauss.drawPOD()

File ~/anaconda3/lib/python3.9/site-packages/otpod-0.6.9-py3.9.egg/otpod/_decorator.py:53, in DocInherit.get_with_inst..f(*args, **kwargs)
51 @wraps(self.mthd, assigned=("name", "module"))
52 def f(*args, **kwargs):
---> 53 return self.mthd(obj, *args, **kwargs)

File ~/anaconda3/lib/python3.9/site-packages/decorator.py:232, in decorate..fun(*args, **kw)
230 if not kwsyntax:
231 args, kw = fix(args, kw, sig)
--> 232 return caller(func, *(extras + args), **kw)

File ~/anaconda3/lib/python3.9/site-packages/otpod-0.6.9-py3.9.egg/otpod/_decorator.py:80, in keepingArgs..wrapper(target, *args, **kwargs)
79 def wrapper(target, *args, **kwargs):
---> 80 return target(*args, **kwargs)

File ~/anaconda3/lib/python3.9/site-packages/otpod-0.6.9-py3.9.egg/otpod/_univariate_linear_model_pod.py:294, in UnivariateLinearModelPOD.drawPOD(self, probabilityLevel, confidenceLevel, defectMin, defectMax, nbPt, name)
281 @DocInherit # decorator to inherit the docstring from POD class
282 @keepingArgs # decorator to keep the real signature
283 def drawPOD(
(...)
290 name=None,
291 ):
293 if confidenceLevel is None:
--> 294 fig, ax = self._drawPOD(
295 self.getPODModel(),
296 None,
297 probabilityLevel,
298 confidenceLevel,
299 defectMin,
300 defectMax,
301 nbPt,
302 name,
303 )
304 elif confidenceLevel is not None:
305 fig, ax = self._drawPOD(
306 self.getPODModel(),
307 self.getPODCLModel(confidenceLevel),
(...)
313 name,
314 )

File ~/anaconda3/lib/python3.9/site-packages/otpod-0.6.9-py3.9.egg/otpod/_pod.py:197, in POD._drawPOD(self, PODmodel, PODmodelCl, probabilityLevel, confidenceLevel, defectMin, defectMax, nbPt, name)
195 fig, ax = plt.subplots(figsize=(8, 6))
196 # POD model graph
--> 197 _ = View(
198 PODmodel.draw(defectMin, defectMax, nbPt),
199 axes=[ax],
200 plot_kw={"color": "red", "label": "POD"},
201 )
203 if confidenceLevel is not None:
204 # POD at confidence level graph
205 _ = View(
206 PODmodelCl.draw(defectMin, defectMax, nbPt),
207 axes=[ax],
(...)
211 },
212 )

File ~/anaconda3/lib/python3.9/site-packages/openturns/viewer.py:299, in View.init(self, graph, pixelsize, figure, figure_kw, axes, plot_kw, axes_kw, bar_kw, pie_kw, polygon_kw, polygoncollection_kw, contour_kw, step_kw, clabel_kw, text_kw, legend_kw, add_legend, square_axes, **kwargs)
294 if (graph.getLogScale() == ot.GraphImplementation.LOGY) or (
295 graph.getLogScale() == ot.GraphImplementation.LOGXY
296 ):
297 self._ax[0].set_yscale("log")
--> 299 self._ax[0].grid(b=graph.getGrid())
301 # use scientific notation on non-log axis
302 axis_mask = {
303 ot.GraphImplementation.NONE: "both",
304 ot.GraphImplementation.LOGX: "y",
305 ot.GraphImplementation.LOGY: "x",
306 ot.GraphImplementation.LOGXY: None,
307 }

File ~/anaconda3/lib/python3.9/site-packages/matplotlib/axes/_base.py:3194, in _AxesBase.grid(self, visible, which, axis, **kwargs)
3192 _api.check_in_list(['x', 'y', 'both'], axis=axis)
3193 if axis in ['x', 'both']:
-> 3194 self.xaxis.grid(visible, which=which, **kwargs)
3195 if axis in ['y', 'both']:
3196 self.yaxis.grid(visible, which=which, **kwargs)

File ~/anaconda3/lib/python3.9/site-packages/matplotlib/axis.py:1660, in Axis.grid(self, visible, which, **kwargs)
1657 if which in ['major', 'both']:
1658 gridkw['gridOn'] = (not self._major_tick_kw['gridOn']
1659 if visible is None else visible)
-> 1660 self.set_tick_params(which='major', **gridkw)
1661 self.stale = True

File ~/anaconda3/lib/python3.9/site-packages/matplotlib/axis.py:932, in Axis.set_tick_params(self, which, reset, **kwargs)
919 """
920 Set appearance parameters for ticks, ticklabels, and gridlines.
921
(...)
929 gridlines.
930 """
931 _api.check_in_list(['major', 'minor', 'both'], which=which)
--> 932 kwtrans = self._translate_tick_params(kwargs)
934 # the kwargs are stored in self._major/minor_tick_kw so that any
935 # future new ticks will automatically get them
936 if reset:

File ~/anaconda3/lib/python3.9/site-packages/matplotlib/axis.py:1076, in Axis.translate_tick_params(kw, reverse)
1074 for key in kw
:
1075 if key not in allowed_keys:
-> 1076 raise ValueError(
1077 "keyword %s is not recognized; valid keywords are %s"
1078 % (key, allowed_keys))
1079 kwtrans.update(kw_)
1080 return kwtrans

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']

Fixed it... was an issue at one of my packages being out of date. Not sure which one, but updated them all and it's fixed.

it was probably openturns/openturns#2240, fixed by openturns 1.21rc1
a new otpod version is on the way too to be fully compatible with openturns>=1.21

Yes, that looks to be the error. Thanks. I’m on a downgraded version of matplotlib now and it seems fine. Not sure how to get openturns 1.21rc1?

you should get it by a conda update