Heatmap python test error

Hello,

I have the typical error with my heatmap, but i can’t fix it:

self.assertEqual(actual, expected, “Expected different values in heat map.”)
AssertionError: Lists differ: ['0.0[607 chars] ‘0.2’, ‘0.1’, ‘0.1’, ‘-0.0’, ‘0.0’, ‘-0.0’, ‘0.1’, ‘’, ‘’, ‘’] != ['0.0[607 chars] ‘0.2’, ‘0.1’, ‘0.1’, ‘-0.0’, ‘0.0’, ‘-0.0’, ‘0.1’]

First list contains 3 additional elements.
First extra element 91:
‘’

I read the forums looking for an answer, the typical answer for this problem is “change the matplotlib version to 3.2.2”, i tried with this version, and with the 3.1.3, and i got the same error, this is my toml archive:

[tool]
[tool.poetry]
authors = [“Your Name you@example.com”]
name = “root”
version = “0.0.0”
description = “”

[tool.poetry.dependencies]
pandas = “"
python = “^3.7”
seaborn = "

matplotlib = “3.2.2”

I tried changed the marplotlib and python version to 3.8, and nothing works. I used the basic functions in my code:

    # Clean the data
    df_heat = df[
      (df['ap_lo'] <= df['ap_hi']) & 
      (df['height'] >= df['height'].quantile(0.025)) & 
      (df['height'] <= df['height'].quantile(0.975)) & 
      (df['weight'] >= df['weight'].quantile(0.025)) & 
      (df['weight'] <= df['weight'].quantile(0.975))
    ]

    # Calculate the correlation matrix
    corr = df_heat.corr()

    # Generate a mask for the upper triangle
    mask = np.triu(corr)

    # Set up the matplotlib figure
    fig, ax = plt.subplots(figsize=(16,16))

    print(ax.get_default_bbox_extra_artists()[-4:-1])

    # Draw the heatmap with 'sns.heatmap()'
    sns.heatmap(corr, mask = mask, annot = True, fmt = ".1f", cmap = "YlGnBu", vmin = 0, vmax = 0.7, square = True, linewidths = .5)

In that print i always got the 3 extra elements, no matters what version i used.

here u can see the whole code

I don’t remember exactly how it was with matplotlib in the past. I’ve forked your project, removed matplotlib from pyproject.toml file, then run:

poetry update matplotlib

And tests are passing without problems.

Thanks!

It works perfectly

I´m having the same issue! Here’s my code. have just added poetry update matplotlib in the toml file but didn’t work, could you help me?

Please create new thread, including full information what’s the error, what have you tried, etc. It will make helping you easier.