mwaskom / seaborn

Statistical data visualization in Python
https://seaborn.pydata.org
BSD 3-Clause "New" or "Revised" License
12.18k stars 1.89k forks source link

Figure in the plot is not showing in heatmap in 0.12.2,but everything works right in 0.9.0 #3695

Closed FukoH closed 1 month ago

FukoH commented 1 month ago

Today I am running this code,but in the plot no figures are showing except for the first row. Dingtalk_20240520161823

from sklearn.metrics import confusion_matrix
import seaborn as sns
import matplotlib.pyplot as plt

# Assuming y_test is your true labels and y_pred is your predicted labels
cm = confusion_matrix(y_test, y_pred)

plt.figure(figsize=(10,7))
sns.heatmap(cm, annot=True,fmt='.0f',cmap='YlGnBu')
plt.xlabel('Predicted')
plt.ylabel('Truth')
plt.show()

Here are the modules installed:

absl-py                   2.1.0                     <pip>
appdirs                   1.4.4              pyhd3eb1b0_0
asttokens                 2.0.5              pyhd3eb1b0_0
astunparse                1.6.3                     <pip>
backcall                  0.2.0              pyhd3eb1b0_0
blas                      1.0                         mkl
boto                      2.49.0           py39haa95532_0
boto3                     1.34.82          py39haa95532_0
botocore                  1.34.82          py39haa95532_0
bottleneck                1.3.7            py39h9128911_0
brotli                    1.0.9                h2bbff1b_8
brotli-bin                1.0.9                h2bbff1b_8
brotli-python             1.0.9            py39hd77b12b_8
bz2file                   0.98             py39haa95532_1
ca-certificates           2024.3.11            haa95532_0
certifi                   2024.2.2         py39haa95532_0
cffi                      1.16.0           py39h2bbff1b_1
charset-normalizer        3.1.0                     <pip>
charset-normalizer        2.0.4              pyhd3eb1b0_0
charset-normalizer        3.3.2                     <pip>
colorama                  0.4.6            py39haa95532_0
comm                      0.2.1            py39haa95532_0
contourpy                 1.2.0            py39h59b6b97_0
cryptography              42.0.5           py39h89fc84f_1
cycler                    0.11.0             pyhd3eb1b0_0
debugpy                   1.6.7            py39hd77b12b_0
decorator                 5.1.1              pyhd3eb1b0_0
exceptiongroup            1.2.0            py39haa95532_0
executing                 0.8.3              pyhd3eb1b0_0
flatbuffers               24.3.25                   <pip>
fonttools                 4.51.0           py39h2bbff1b_0
freetype                  2.12.1               ha860e81_0
gast                      0.5.4                     <pip>
gensim                    4.3.2                     <pip>
google-pasta              0.2.0                     <pip>
grpcio                    1.63.0                    <pip>
h5py                      3.11.0                    <pip>
icc_rt                    2022.1.0             h6049295_2
idna                      3.7              py39haa95532_0
importlib-metadata        7.0.1            py39haa95532_0
importlib_metadata        7.1.0                     <pip>
importlib_metadata        7.0.1                hd3eb1b0_0
importlib_resources       6.1.1            py39haa95532_1
intel-openmp              2023.1.0         h59b6b97_46320
ipykernel                 6.28.0           py39haa95532_0
ipython                   8.15.0           py39haa95532_0
jedi                      0.18.1           py39haa95532_1
jieba                     0.42.1                    <pip>
jmespath                  1.0.1            py39haa95532_0
joblib                    1.4.0            py39haa95532_0
jpeg                      9e                   h2bbff1b_1
jupyter_client            8.6.0            py39haa95532_0
jupyter_core              5.5.0            py39haa95532_0
keras                     3.3.3                     <pip>
kiwisolver                1.4.4            py39hd77b12b_0
lcms2                     2.12                 h83e58a3_0
lerc                      3.0                  hd77b12b_0
libbrotlicommon           1.0.9                h2bbff1b_8
libbrotlidec              1.0.9                h2bbff1b_8
libbrotlienc              1.0.9                h2bbff1b_8
libclang                  18.1.1                    <pip>
libdeflate                1.17                 h2bbff1b_1
libpng                    1.6.39               h8cc25b3_0
libsodium                 1.0.18               h62dcd97_0
libtiff                   4.5.1                hd77b12b_0
libwebp-base              1.3.2                h2bbff1b_0
lz4-c                     1.9.4                h2bbff1b_1
Markdown                  3.6                       <pip>
markdown-it-py            3.0.0                     <pip>
MarkupSafe                2.1.5                     <pip>
matplotlib-base           3.8.4            py39h4ed8f06_0
matplotlib-inline         0.1.6            py39haa95532_0
mdurl                     0.1.2                     <pip>
mkl                       2023.1.0         h6b88ed4_46358
mkl-service               2.4.0            py39h2bbff1b_1
mkl_fft                   1.3.8            py39h2bbff1b_0
mkl_random                1.2.4            py39h59b6b97_0
ml-dtypes                 0.3.2                     <pip>
namex                     0.0.8                     <pip>
nest-asyncio              1.6.0            py39haa95532_0
numexpr                   2.8.7            py39h2cd9be0_0
numpy                     1.26.4           py39h055cbcc_0
numpy-base                1.26.4           py39h65a83cf_0
openjpeg                  2.4.0                h4fc8c34_0
openssl                   3.0.13               h2bbff1b_1
opt-einsum                3.3.0                     <pip>
optree                    0.11.0                    <pip>
packaging                 23.2             py39haa95532_0
packaging                 24.0                      <pip>
pandas                    1.4.4            py39hd77b12b_0
parso                     0.8.3              pyhd3eb1b0_0
pickleshare               0.7.5           pyhd3eb1b0_1003
pillow                    10.3.0           py39h2bbff1b_0
pip                       24.0             py39haa95532_0
platformdirs              3.10.0           py39haa95532_0
pooch                     1.4.0              pyhd3eb1b0_0
prompt-toolkit            3.0.43           py39haa95532_0
protobuf                  4.25.3                    <pip>
psutil                    5.9.0            py39h2bbff1b_0
pure_eval                 0.2.2              pyhd3eb1b0_0
pybind11-abi              5                    hd3eb1b0_0
pycparser                 2.21               pyhd3eb1b0_0
pygments                  2.15.1           py39haa95532_1
Pygments                  2.18.0                    <pip>
pyopenssl                 24.0.0           py39haa95532_0
pyparsing                 3.0.9            py39haa95532_0
pysocks                   1.7.1            py39haa95532_0
python                    3.9.19               h1aa4202_1
python-dateutil           2.9.0post0       py39haa95532_0
pytz                      2024.1           py39haa95532_0
pywin32                   305              py39h2bbff1b_0
pyzmq                     25.1.2           py39hd77b12b_0
requests                  2.31.0           py39haa95532_1
rich                      13.7.1                    <pip>
s3transfer                0.10.1           py39haa95532_0
scikit-learn              1.4.2            py39h4ed8f06_1
scipy                     1.12.0           py39h8640f81_0
seaborn                   0.12.2           py39haa95532_0
setuptools                69.5.1           py39haa95532_0
six                       1.16.0             pyhd3eb1b0_1
smart-open                7.0.4                     <pip>
smart_open                1.9.0                      py_0
sqlite                    3.45.3               h2bbff1b_0
stack_data                0.2.0              pyhd3eb1b0_0
tbb                       2021.8.0             h59b6b97_0
tensorboard               2.16.2                    <pip>
tensorboard-data-server   0.7.2                     <pip>
tensorflow                2.16.1                    <pip>
tensorflow-intel          2.16.1                    <pip>
tensorflow-io-gcs-filesystem 0.31.0                    <pip>
termcolor                 2.4.0                     <pip>
threadpoolctl             2.2.0              pyh0d69192_0
tornado                   6.3.3            py39h2bbff1b_0
traitlets                 5.7.1            py39haa95532_0
typing_extensions         4.11.0           py39haa95532_0
tzdata                    2024a                h04d1e81_0
unicodedata2              15.1.0           py39h2bbff1b_0
urllib3                   2.2.1                     <pip>
urllib3                   1.26.18          py39haa95532_0
vc                        14.2                 h21ff451_1
vs2015_runtime            14.27.29016          h5e58377_2
wcwidth                   0.2.5              pyhd3eb1b0_0
Werkzeug                  3.0.3                     <pip>
wheel                     0.43.0           py39haa95532_0
win_inet_pton             1.1.0            py39haa95532_0
wrapt                     1.16.0                    <pip>
xz                        5.4.6                h8cc25b3_1
zeromq                    4.3.5                hd77b12b_0
zipp                      3.17.0           py39haa95532_0
zipp                      3.18.1                    <pip>
zlib                      1.2.13               h8cc25b3_1
zstd                      1.5.5                hd43e919_2

After encountering this abnormal, I turn to python 3.7 with 0.9.0 ,everything works right. Dingtalk_20240520161912

_ipyw_jlab_nb_ext_conf    0.1.0                    py37_0
alabaster                 0.7.11                   py37_0
anaconda                  5.3.1                    py37_0
anaconda-client           1.7.2                    py37_0
anaconda-navigator        1.9.2                    py37_0
anaconda-project          0.8.2                    py37_0
appdirs                   1.4.3            py37h28b3542_0
asn1crypto                0.24.0                   py37_0
astroid                   2.0.4                    py37_0
astropy                   3.0.4            py37hfa6e2cd_0
astunparse                1.6.3                     <pip>
atomicwrites              1.2.1                    py37_0
attrs                     18.2.0           py37h28b3542_0
automat                   0.7.0                    py37_0
babel                     2.6.0                    py37_0
backcall                  0.1.0                    py37_0
backports                 1.0                      py37_1
backports.shutil_get_terminal_size 1.0.0                    py37_2
beautifulsoup4            4.6.3                    py37_0
bitarray                  0.8.3            py37hfa6e2cd_0
bkcharts                  0.2                      py37_0
blas                      1.0                         mkl
blaze                     0.11.3                   py37_0
bleach                    2.1.4                    py37_0
blosc                     1.14.4               he51fdeb_0
bokeh                     0.13.0                   py37_0
boto                      2.49.0                   py37_0
bottleneck                1.2.1            py37h452e1ab_1
bzip2                     1.0.6                hfa6e2cd_5
ca-certificates           2018.03.07                    0
certifi                   2018.8.24                py37_1
cffi                      1.11.5           py37h74b6da3_1
chardet                   3.0.4                    py37_1
click                     6.7                      py37_0
cloudpickle               0.5.5                    py37_0
clyent                    1.2.2                    py37_1
colorama                  0.3.9                    py37_0
comtypes                  1.1.7                    py37_0
conda                     4.5.11                   py37_0
conda-build               3.15.1                   py37_0
conda-env                 2.6.0                         1
console_shortcut          0.1.1                         3
constantly                15.1.0           py37h28b3542_0
contextlib2               0.5.5                    py37_0
cryptography              2.3.1            py37h74b6da3_0
curl                      7.61.0               h7602738_0
cycler                    0.10.0                   py37_0
Cython                    0.29.28                   <pip>
cython                    0.28.5           py37h6538335_0
cytoolz                   0.9.0.1          py37hfa6e2cd_1
dask                      0.19.1                   py37_0
dask-core                 0.19.1                   py37_0
datashape                 0.5.4                    py37_1
decorator                 4.3.0                    py37_0
defusedxml                0.5.0                    py37_1
distlib                   0.3.8                     <pip>
distributed               1.23.1                   py37_0
docutils                  0.14                     py37_0
entrypoints               0.2.3                    py37_2
et_xmlfile                1.0.1                    py37_0
fastcache                 1.0.2            py37hfa6e2cd_2
filelock                  3.0.8                    py37_0
filelock                  3.12.2                    <pip>
flask                     1.0.2                    py37_1
flask-cors                3.0.6                    py37_0
flatbuffers               24.3.25                   <pip>
freetype                  2.9.1                ha9979f8_1
gast                      0.4.0                     <pip>
gensim                    4.2.0                     <pip>
get_terminal_size         1.0.0                h38e98db_0
gevent                    1.3.6            py37hfa6e2cd_0
glob2                     0.6                      py37_0
greenlet                  0.4.15           py37hfa6e2cd_0
h5py                      3.8.0                     <pip>
h5py                      2.8.0            py37h3bdd7fb_2
hdf5                      1.10.2               hac2f561_1
heapdict                  1.0.0                    py37_2
html5lib                  1.0.1                    py37_0
hyperlink                 18.0.0                   py37_0
icc_rt                    2017.0.4             h97af966_0
icu                       58.2                 ha66f8fd_1
idna                      2.7                      py37_0
imageio                   2.4.1                    py37_0
imagesize                 1.1.0                    py37_0
importlib-metadata        6.7.0                     <pip>
incremental               17.5.0                   py37_0
intel-openmp              2019.0                      118
ipykernel                 4.10.0                   py37_0
ipython                   6.5.0                    py37_0
ipython_genutils          0.2.0                    py37_0
ipywidgets                7.4.1                    py37_0
isort                     4.3.4                    py37_0
itsdangerous              0.24                     py37_1
jdcal                     1.4                      py37_0
jedi                      0.12.1                   py37_0
jieba                     0.42.1                    <pip>
jinja2                    2.10                     py37_0
joblib                    1.3.2                     <pip>
jpeg                      9b                   hb83a4c4_2
jsonschema                2.6.0                    py37_0
jupyter                   1.0.0                    py37_7
jupyter_client            5.2.3                    py37_0
jupyter_console           5.2.0                    py37_1
jupyter_core              4.4.0                    py37_0
jupyterlab                0.34.9                   py37_0
jupyterlab_launcher       0.13.1                   py37_0
keras                     2.11.0                    <pip>
keyring                   13.2.1                   py37_0
kiwisolver                1.0.1            py37h6538335_0
lazy-object-proxy         1.3.1            py37hfa6e2cd_2
libclang                  18.1.1                    <pip>
libcurl                   7.61.0               h7602738_0
libiconv                  1.15                 h1df5818_7
libpng                    1.6.34               h79bbb47_0
libsodium                 1.0.16               h9d3ae62_0
libssh2                   1.8.0                hd619d38_4
libtiff                   4.0.9                h36446d0_2
libxml2                   2.9.8                hadb2253_1
libxslt                   1.1.32               hf6f1972_0
llvmlite                  0.24.0           py37h6538335_0
locket                    0.2.0                    py37_1
lxml                      4.2.5            py37hef2cd61_0
lzo                       2.10                 h6df0209_2
m2w64-gcc-libgfortran     5.3.0                         6
m2w64-gcc-libs            5.3.0                         7
m2w64-gcc-libs-core       5.3.0                         7
m2w64-gmp                 6.1.0                         2
m2w64-libwinpthread-git   5.0.0.4634.697f757               2
markupsafe                1.0              py37hfa6e2cd_1
matplotlib                2.2.3            py37hd159220_0
mccabe                    0.6.1                    py37_1
menuinst                  1.4.14           py37hfa6e2cd_0
mistune                   0.8.3            py37hfa6e2cd_1
mkl                       2019.0                      118
mkl-service               1.1.2            py37hb217b18_5
mkl_fft                   1.0.4            py37h1e22a9b_1
mkl_random                1.0.1            py37h77b88f5_1
more-itertools            4.3.0                    py37_0
mpmath                    1.0.0                    py37_2
msgpack-python            0.5.6            py37he980bc4_1
msys2-conda-epoch         20160418                      1
multipledispatch          0.6.0                    py37_0
navigator-updater         0.2.1                    py37_0
nbconvert                 5.4.0                    py37_1
nbformat                  4.4.0                    py37_0
networkx                  2.1                      py37_0
nltk                      3.3.0                    py37_0
nose                      1.3.7                    py37_2
notebook                  5.6.0                    py37_0
numba                     0.39.0           py37h830ac7b_0
numexpr                   2.6.8            py37h9ef55f4_0
numpy                     1.15.1           py37ha559c80_0
numpy                     1.21.6                    <pip>
numpy-base                1.15.1           py37h8128ebf_0
numpydoc                  0.8.0                    py37_0
odo                       0.5.1                    py37_0
olefile                   0.46                     py37_0
openpyxl                  2.5.6                    py37_0
openssl                   1.0.2p               hfa6e2cd_0
opt-einsum                3.3.0                     <pip>
packaging                 17.1                     py37_0
pandas                    0.23.4           py37h830ac7b_0
pandoc                    1.19.2.1             hb2460c7_1
pandocfilters             1.4.2                    py37_1
parso                     0.3.1                    py37_0
partd                     0.3.8                    py37_0
path.py                   11.1.0                   py37_0
pathlib2                  2.3.2                    py37_0
patsy                     0.5.0                    py37_0
pep8                      1.7.1                    py37_0
pickleshare               0.7.4                    py37_0
pillow                    5.2.0            py37h08bbbbd_0
pip                       10.0.1                   py37_0
pkginfo                   1.4.2                    py37_1
platformdirs              4.0.0                     <pip>
plotly                    5.18.0                    <pip>
plotly-express            0.4.1                     <pip>
pluggy                    0.7.1            py37h28b3542_0
ply                       3.11                     py37_0
prometheus_client         0.3.1            py37h28b3542_0
prompt_toolkit            1.0.15                   py37_0
protobuf                  3.19.6                    <pip>
psutil                    5.4.7            py37hfa6e2cd_0
py                        1.6.0                    py37_0
pyasn1                    0.4.4            py37h28b3542_0
pyasn1-modules            0.2.2                    py37_0
pycodestyle               2.4.0                    py37_0
pycosat                   0.6.3            py37hfa6e2cd_0
pycparser                 2.18                     py37_1
pycrypto                  2.6.1            py37hfa6e2cd_9
pycurl                    7.43.0.2         py37h74b6da3_0
pyflakes                  2.0.0                    py37_0
pygments                  2.2.0                    py37_0
PyHamcrest                2.1.0                     <pip>
pylint                    2.1.1                    py37_0
pyodbc                    4.0.24           py37h6538335_0
pyopenssl                 18.0.0                   py37_0
pyparsing                 2.2.0                    py37_1
pyqt                      5.9.2            py37h6538335_2
pysocks                   1.6.8                    py37_0
pytables                  3.4.4            py37he6f6034_0
pytest                    3.8.0                    py37_0
pytest-arraydiff          0.2              py37h39e3cac_0
pytest-astropy            0.4.0                    py37_0
pytest-doctestplus        0.1.3                    py37_0
pytest-openfiles          0.3.0                    py37_0
pytest-remotedata         0.3.0                    py37_0
python                    3.7.0                hea74fb7_0
python-dateutil           2.7.3                    py37_0
pytz                      2018.5                   py37_0
pywavelets                1.0.0            py37h452e1ab_0
pywin32                   223              py37hfa6e2cd_1
pywinpty                  0.5.4                    py37_0
pyyaml                    3.13             py37hfa6e2cd_0
pyzmq                     17.1.2           py37hfa6e2cd_0
qt                        5.9.6            vc14h1e9a669_2  [vc14]
qtawesome                 0.4.4                    py37_0
qtconsole                 4.4.1                    py37_0
qtpy                      1.5.0                    py37_0
requests                  2.19.1                   py37_0
rope                      0.11.0                   py37_0
ruamel_yaml               0.15.46          py37hfa6e2cd_0
scikit-image              0.14.0           py37h6538335_1
scikit-learn              0.19.2           py37heebcf9a_0
scipy                     1.1.0            py37h4f6bf74_1
seaborn                   0.9.0                    py37_0
send2trash                1.5.0                    py37_0
service_identity          17.0.0           py37h28b3542_0
setuptools                40.2.0                   py37_0
simplegeneric             0.8.1                    py37_2
singledispatch            3.4.0.3                  py37_0
sip                       4.19.8           py37h6538335_0
six                       1.16.0                    <pip>
six                       1.11.0                   py37_1
smart-open                7.0.4                     <pip>
snappy                    1.1.7                h777316e_3
snowballstemmer           1.2.1                    py37_0
sortedcollections         1.0.1                    py37_0
sortedcontainers          2.0.5                    py37_0
sphinx                    1.7.9                    py37_0
sphinxcontrib             1.0                      py37_1
sphinxcontrib-websupport  1.1.0                    py37_1
spyder                    3.3.1                    py37_1
spyder-kernels            0.2.6                    py37_0
sqlalchemy                1.2.11           py37hfa6e2cd_0
sqlite                    3.24.0               h7602738_0
statsmodels               0.9.0            py37h452e1ab_0
sympy                     1.1.1                    py37_0
tblib                     1.3.2                    py37_0
tenacity                  8.2.3                     <pip>
tensorflow-estimator      2.11.0                    <pip>
termcolor                 2.3.0                     <pip>
terminado                 0.8.1                    py37_1
testpath                  0.3.1                    py37_0
tk                        8.6.8                hfa6e2cd_0
toolz                     0.9.0                    py37_0
tornado                   5.1              py37hfa6e2cd_0
tqdm                      4.26.0           py37h28b3542_0
traitlets                 4.3.2                    py37_0
twisted                   18.7.0           py37hfa6e2cd_1
typing_extensions         4.7.1                     <pip>
unicodecsv                0.14.1                   py37_0
urllib3                   1.23                     py37_0
vc                        14.1                 h0510ff6_4
virtualenv                20.26.1                   <pip>
vs2015_runtime            14.15.26706          h3a45250_0
wcwidth                   0.1.7                    py37_0
webencodings              0.5.1                    py37_1
werkzeug                  0.14.1                   py37_0
wheel                     0.31.1                   py37_0
widgetsnbextension        3.4.1                    py37_0
win_inet_pton             1.0.1                    py37_1
win_unicode_console       0.5                      py37_0
wincertstore              0.2                      py37_0
winpty                    0.4.3                         4
wrapt                     1.10.11          py37hfa6e2cd_2
xgboost                   1.6.2                     <pip>
xlrd                      1.1.0                    py37_1
xlsxwriter                1.1.0                    py37_0
xlwings                   0.11.8                   py37_0
xlwt                      1.3.0                    py37_0
yaml                      0.1.7                hc54c509_2
zeromq                    4.2.5                he025d50_1
zict                      0.1.3                    py37_0
zipp                      3.15.0                    <pip>
zlib                      1.2.11               h8395fce_2
zope                      1.0                      py37_1
zope.interface            4.5.0            py37hfa6e2cd_0
mwaskom commented 1 month ago

Dupe https://github.com/mwaskom/seaborn/issues/3478