简体   繁体   English

seaborn pairplot 不适用于单个图

[英]seaborn pairplot not working for single graph

I get this weird behavior where seaborn will plot diffrent graphs as expected but fails to show data in a single graph.我得到了这种奇怪的行为,其中 seaborn 会按预期绘制不同的图表,但无法在单个图表中显示数据。

I am using anaconda3 and Visual Studio (same problem in jupyter).我正在使用 anaconda3 和 Visual Studio(在 jupyter 中存在同样的问题)。

seaborn is v0.11.0 seaborn 是 v0.11.0
matplotlib is v3.3.1 matplotlib 是 v3.3.1
anaconda3 is v1.9.12 anaconda3 是 v1.9.12
python is v3.8.3 python是v3.8.3
MSC is v.1916 64 bit MSC 是 v.1916 64 位

import seaborn as sns
import matplotlib.pyplot as plt

tips = sns.load_dataset("tips")

sns.pairplot(x_vars=["tip"], y_vars=["size"], 
            data=tips)
sns.pairplot(tips)
plt.show()

the outputs look like this:输出如下所示:

output for sns.pairplot(x_vars=["tip"], y_vars=["size"],data=tips) sns.pairplot(x_vars=["tip"], y_vars=["size"],data=tips) 的输出

output for sns.pairplot(tips) sns.pairplot 的输出(提示)

It seems that the data is clearly there, but is somehow not plottet in the former statement.似乎数据显然存在,但在前面的陈述中不知何故不是 plottet。

edit: It seems to be a library version problem.编辑:这似乎是一个库版本问题。

these are may library versions:这些可能是库版本:

# Name                    Version                   Build  Channel
attrs                     20.2.0                     py_0
backcall                  0.2.0                      py_0
blas                      1.0                         mkl
bzip2                     1.0.8                he774522_0
ca-certificates           2020.7.22                     0
certifi                   2020.6.20                py38_0
cfitsio                   3.470                he774522_6
click                     7.1.2                      py_0
click-plugins             1.1.1                      py_0
cligj                     0.5.0                    py38_0
colorama                  0.4.3                      py_0
curl                      7.67.0               h2a8f88b_0
cycler                    0.10.0                   py38_0
decorator                 4.4.2                      py_0
expat                     2.2.9                h33f27b4_2
fiona                     1.8.13.post1     py38hd760492_0
freetype                  2.10.2               hd328e21_0
freexl                    1.0.5                hfa6e2cd_0
gdal                      3.0.2            py38hdf43c64_0
geopandas                 0.8.1                      py_0
geos                      3.8.0                h33f27b4_0
geotiff                   1.5.1                h5770a2b_1
hdf4                      4.2.13               h712560f_2
hdf5                      1.10.4               h7ebc959_0
icc_rt                    2019.0.0             h0cc432a_1
icu                       58.2                 ha925a31_3
intel-openmp              2020.2                      254
ipykernel                 5.3.4            py38h5ca1d4c_0
ipython                   7.18.1           py38h5ca1d4c_0
ipython_genutils          0.2.0                    py38_0
jedi                      0.17.2                   py38_0
joblib                    0.16.0                     py_0
jpeg                      9b                   hb83a4c4_2
jupyter_client            6.1.7                      py_0
jupyter_core              4.6.3                    py38_0
kealib                    1.4.7                h07cbb95_6
kiwisolver                1.2.0            py38h74a9793_0
krb5                      1.16.4               hc04afaa_0
libboost                  1.67.0               hd9e427e_4
libcurl                   7.67.0               h2a8f88b_0
libgdal                   3.0.2                h1155b67_0
libiconv                  1.15                 h1df5818_7
libkml                    1.3.0                he5f2a48_4
libnetcdf                 4.6.1                h411e497_2
libpng                    1.6.37               h2a8f88b_0
libpq                     11.2                 h3235a2c_0
libsodium                 1.0.18               h62dcd97_0
libspatialindex           1.9.3                h33f27b4_0
libspatialite             4.3.0a               h7ffb84d_0
libssh2                   1.9.0                h7a1dbc1_1
libtiff                   4.1.0                h56a325e_0
libxml2                   2.9.10               h464c3ec_1
lz4-c                     1.8.1.2              h2fa13f4_0
m2w64-expat               2.1.1                         2
m2w64-gcc-libgfortran     5.3.0                         6
m2w64-gcc-libs            5.3.0                         7
m2w64-gcc-libs-core       5.3.0                         7
m2w64-gettext             0.19.7                        2
m2w64-gmp                 6.1.0                         2
m2w64-libiconv            1.14                          6
m2w64-libwinpthread-git   5.0.0.4634.697f757               2
m2w64-xz                  5.2.2                         2
matplotlib                3.3.1                         0
matplotlib-base           3.3.1            py38hba9282a_0
mkl                       2020.2                      256
mkl-service               2.3.0            py38hb782905_0
mkl_fft                   1.2.0            py38h45dec08_0
mkl_random                1.1.1            py38h47e9c7a_0
msys2-conda-epoch         20160418                      1
munch                     2.5.0                      py_0
numpy                     1.19.1           py38h5510c5b_0
numpy-base                1.19.1           py38ha3acd2a_0
olefile                   0.46                       py_0
openjpeg                  2.3.0                h5ec785f_1
openssl                   1.1.1h               he774522_0
pandas                    1.1.1            py38ha925a31_0
parso                     0.7.0                      py_0
pcre                      8.44                 ha925a31_0
pickleshare               0.7.5                 py38_1000
pillow                    7.2.0            py38hcc1f983_0
pip                       20.2.2                   py38_0
postgresql                11.2                 h3235a2c_0
proj                      6.2.1                h9f7ef89_0
prompt-toolkit            3.0.7                      py_0
pygments                  2.7.1                      py_0
pyparsing                 2.4.7                      py_0
pyproj                    2.6.1.post1      py38hcfa1391_1
pyqt                      5.9.2            py38ha925a31_4
python                    3.8.5                h5fd99cc_1
python-dateutil           2.8.1                      py_0
pytz                      2020.1                     py_0
pywin32                   227              py38he774522_1
pyzmq                     19.0.2           py38ha925a31_1
qt                        5.9.7            vc14h73c81de_0
rtree                     0.9.4            py38h21ff451_1
scikit-learn              0.23.2           py38h47e9c7a_0
scipy                     1.5.0            py38h9439919_0
seaborn                   0.11.0                     py_0
setuptools                49.6.0                   py38_1
shapely                   1.7.1            py38h210f175_0
sip                       4.19.13          py38ha925a31_0
six                       1.15.0                     py_0
sqlite                    3.33.0               h2a8f88b_0
tbb                       2018.0.5             he980bc4_0
threadpoolctl             2.1.0              pyh5ca1d4c_0
tiledb                    1.6.3                h7b000aa_0
tk                        8.6.10               he774522_0
tornado                   6.0.4            py38he774522_1
traitlets                 5.0.4                      py_0
vc                        14.1                 h0510ff6_4
vs2015_runtime            14.16.27012          hf0eaf9b_3
wcwidth                   0.2.5                      py_0
wheel                     0.35.1                     py_0
wincertstore              0.2                      py38_0
xerces-c                  3.2.3                ha925a31_0
xz                        5.2.5                h62dcd97_0
zeromq                    4.3.2                ha925a31_3
zlib                      1.2.11               h62dcd97_4
zstd                      1.3.7                h508b16e_0

I think there is a bug in either matplotlib 3.3.1 or in seaborn 0.11.0 .我认为 matplotlib 3.3.1或 seaborn 0.11.0中存在0.11.0 I checked with the given environment and giving a blank graph with sns.pairplot(x_vars=["tip"], y_vars=["size"],data=tips) .我检查了给定的环境并给出了一个带有sns.pairplot(x_vars=["tip"], y_vars=["size"],data=tips)的空白图。

Solution : Change your matplotlib version to 3.2.1 and seaborn version to 0.10.1 .解决方案:将您的 matplotlib 版本更改为3.2.1 ,将 seaborn 版本更改为0.10.1 It worked for me with given versions.对于给定的版本,它对我有用。

If you are using yml file to create conda environment, use following content in .yml file.如果您使用 yml 文件创建 conda 环境,请使用.yml文件中的以下内容。

name: test
channels:
  - conda-forge
  - defaults
dependencies:
  - python=3.8
  - seaborn=0.10.1
  - matplotlib=3.2.1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM