Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

analysis.analysis.adaptation_table() fails #430

Open
wedeling opened this issue Oct 5, 2024 · 0 comments
Open

analysis.analysis.adaptation_table() fails #430

wedeling opened this issue Oct 5, 2024 · 0 comments
Assignees

Comments

@wedeling
Copy link
Collaborator

wedeling commented Oct 5, 2024

I get this error:

ValueError                                Traceback (most recent call last)
Cell In[49], line 1
----> 1 analysis.adaptation_table()

File [~/py-env/lib/python3.9/site-packages/easyvvuq/analysis/sc_analysis.py:798](http://localhost:8888/lab/tree/CWI/semester_programme/UQ/my_school_talk/scripts/assignments/EasyVVUQ_dimension_adaptive/py-env/lib/python3.9/site-packages/easyvvuq/analysis/sc_analysis.py#line=797), in SCAnalysis.adaptation_table(self, **kwargs)
    796 sm = plt.cm.ScalarMappable(cmap=cmap, norm=norm)
    797 sm.set_array([])
--> 798 cb = plt.colorbar(sm)
    799 # plot the quad order in the middle of the colorbar intervals
    800 p = np.linspace(0, M - 1, M + 1)

File [~/py-env/lib/python3.9/site-packages/matplotlib/pyplot.py:2516](http://localhost:8888/lab/tree/CWI/semester_programme/UQ/my_school_talk/scripts/assignments/EasyVVUQ_dimension_adaptive/py-env/lib/python3.9/site-packages/matplotlib/pyplot.py#line=2515), in colorbar(mappable, cax, ax, **kwargs)
   2511     if mappable is None:
   2512         raise RuntimeError('No mappable was found to use for colorbar '
   2513                            'creation. First define a mappable such as '
   2514                            'an image (with imshow) or a contour set ('
   2515                            'with contourf).')
-> 2516 ret = gcf().colorbar(mappable, cax=cax, ax=ax, **kwargs)
   2517 return ret

File [~/py-env/lib/python3.9/site-packages/matplotlib/figure.py:1215](http://localhost:8888/lab/tree/CWI/semester_programme/UQ/my_school_talk/scripts/assignments/EasyVVUQ_dimension_adaptive/py-env/lib/python3.9/site-packages/matplotlib/figure.py#line=1214), in FigureBase.colorbar(self, mappable, cax, ax, use_gridspec, **kwargs)
   1213 if cax is None:
   1214     if ax is None:
-> 1215         raise ValueError(
   1216             'Unable to determine Axes to steal space for Colorbar. '
   1217             'Either provide the *cax* argument to use as the Axes for '
   1218             'the Colorbar, provide the *ax* argument to steal space '
   1219             'from it, or add *mappable* to an Axes.')
   1220     fig = (  # Figure of first Axes; logic copied from make_axes.
   1221         [*ax.flat] if isinstance(ax, np.ndarray)
   1222         else [*ax] if np.iterable(ax)
   1223         else [ax])[0].figure
   1224     current_ax = fig.gca()

ValueError: Unable to determine Axes to steal space for Colorbar. Either provide the *cax* argument to use as the Axes for the Colorbar, provide the *ax* argument to steal space from it, or add *mappable* to an Axes.

Perhaps this is an incompatibility with a newer matplotlib version. I used 3.9.2.

@wedeling wedeling self-assigned this Oct 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant