pymc-devs / pymc-devs/pymc-examples

Error in `examples/samplers/DEMetropolisZ_EfficiencyComparison.ipynb`

Open Beginner friendly
#731 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
398
Forks
325
Avg merge
9d 15m
Merged PRs (30d)
1

Description

Not working with matplotlib '3.9.2'

──────────────────────────────────── Error running examples/samplers/DEMetropolisZ_EfficiencyComparison.ipynb ────────────────────────────────────

---------------------------------------------------------------------------
Exception encountered at "In [18]":
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
Cell In[18], line 1
----> 1 plot_forest_compare_analytical(results_df)

Cell In[12], line 41, in plot_forest_compare_analytical(results_df)
     39 labels = ax.get_legend().__dict__["texts"]
     40 labels = [label.__dict__["_text"] for label in labels]
---> 41 handles = ax.get_legend().__dict__["legendHandles"]
     42 ax.legend(
     43     handles[::-1],
     44     labels[::-1],
   (...)
     49     title="94% and 50% HDI",
     50 )
     51 ax.set_title(
     52     f"Comparison of MCMC Samples and Analytical Solutions\nFirst 5 Dimensions of {D} Dimensional Target Distribution"
     53 )

KeyError: 'legendHandles'

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open examples/samplers/DEMetropolisZ_EfficiencyComparison.ipynb and inspect the plotting function in cell In [12], especially the legend handling reported in the traceback. Run the notebook with matplotlib 3.9.2 and confirm that cell In [18] completes without the KeyError and produces the comparison plot.

Written by the indexing model from the issue text.

Assessment

Tech stack
matplotlib, python
Domain
data-visualization, documentation
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.