Search code examples
matplotlibplotnine

plotnine is broken with matplotlib==3.6


I am getting the following error with plotnine==0.9 and matplotlib==3.6.

 File "D:\Python\Python310\lib\site-packages\plotnine\stats\stat_density_2d.py", line 3, in <module>
    import matplotlib._contour as _contour
ModuleNotFoundError: No module named 'matplotlib._contour'

If I downgrade matplotlib==3.5, the problem goes away.


Solution

  • It's discussed here and it's already fixed here Note that it's already merged to main.

    It was due to a internal matplotlib call that is no longer supported and has been replaced.

    So I guess you could choose between:

    • downgrade to mlp 3.5.3
    • install plotnine@main

    till the next plotnine release.