Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scatterplot bug in 0.13.0 #3575

Open
CommonClimate opened this issue Nov 29, 2023 · 2 comments
Open

scatterplot bug in 0.13.0 #3575

CommonClimate opened this issue Nov 29, 2023 · 2 comments

Comments

@CommonClimate
Copy link

Hello and first off, major thanks to @mwaskom for this incredible package. I report this bug as a developer of Pyleoclim, which has seaborn as a dependency.

In upgrading to Python 3.11, we also upgraded to seaborn 0.13.0, and this docstring example starting giving us grief. Specifically:

Traceback (most recent call last):

  Cell In[3], line 17
    gs.map_neighbors(mgs, radius=4000)

  File ~/Documents/GitHub/Pyleoclim_util/pyleoclim/core/geoseries.py:446 in map_neighbors
    fig, ax_d = mapping.scatter_map(neighborhood, fig=fig, gs_slot=gridspec_slot, hue=hue, size=size, marker=marker, projection=projection,

  File ~/Documents/GitHub/Pyleoclim_util/pyleoclim/utils/mapping.py:1205 in scatter_map
    _, ax_d = plot_scatter(df=df, x=x, y=y, hue_var=hue, size_var=size, marker_var=marker, ax_d=ax_d, proj=None, edgecolor=edgecolor,

  File ~/Documents/GitHub/Pyleoclim_util/pyleoclim/utils/mapping.py:946 in plot_scatter
    sns.scatterplot(data=hue_data, x=x, y=y, hue=hue_var, size=size_var,transform=transform, #change to transform=scatter_kwargs['transform']

  File ~/opt/miniconda3/envs/pyleo/lib/python3.11/site-packages/seaborn/relational.py:624 in scatterplot
    p.plot(ax, kwargs)

  File ~/opt/miniconda3/envs/pyleo/lib/python3.11/site-packages/seaborn/relational.py:458 in plot
    self.add_legend_data(ax, _scatter_legend_artist, kws, attrs)

  File ~/opt/miniconda3/envs/pyleo/lib/python3.11/site-packages/seaborn/_base.py:1270 in add_legend_data
    artist = func(label=label, **{"color": ".2", **common_kws, **level_kws})

  File ~/opt/miniconda3/envs/pyleo/lib/python3.11/site-packages/seaborn/utils.py:922 in _scatter_legend_artist
    if edgecolor == "face":

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

The problem goes away if I revert to seaborn 0.12.2, keeping all other packages the same. My environment.yml is copied to help troubleshoot. It seems that it the fix could be a minor change in _scatter_legend_artist but I don't have a good sense of the ramifications.

Best,
J.E.G.

--
name: pyleo
channels:

  • defaults
    dependencies:
  • alabaster=0.7.12=pyhd3eb1b0_0
  • appnope=0.1.2=py311hecd8cb5_1001
  • asttokens=2.0.5=pyhd3eb1b0_0
  • babel=2.11.0=py311hecd8cb5_0
  • backcall=0.2.0=pyhd3eb1b0_0
  • brotli-python=1.0.9=py311hcec6c5f_7
  • bzip2=1.0.8=h1de35cc_0
  • ca-certificates=2023.08.22=hecd8cb5_0
  • certifi=2023.11.17=py311hecd8cb5_0
  • cffi=1.16.0=py311h6c40b1e_0
  • cloudpickle=2.2.1=py311hecd8cb5_0
  • colorama=0.4.6=py311hecd8cb5_0
  • cryptography=41.0.3=py311h30e54ef_0
  • debugpy=1.6.7=py311hcec6c5f_0
  • decorator=5.1.1=pyhd3eb1b0_0
  • docutils=0.18.1=py311hecd8cb5_3
  • executing=0.8.3=pyhd3eb1b0_0
  • idna=3.4=py311hecd8cb5_0
  • imagesize=1.4.1=py311hecd8cb5_0
  • ipykernel=6.25.0=py311h85bffb1_0
  • ipython=8.15.0=py311hecd8cb5_0
  • jedi=0.18.1=py311hecd8cb5_1
  • jinja2=3.1.2=py311hecd8cb5_0
  • jupyter_client=8.6.0=py311hecd8cb5_0
  • jupyter_core=5.5.0=py311hecd8cb5_0
  • libcxx=14.0.6=h9765a3e_0
  • libffi=3.4.4=hecd8cb5_0
  • libsodium=1.0.18=h1de35cc_0
  • markupsafe=2.1.1=py311h6c40b1e_0
  • matplotlib-inline=0.1.6=py311hecd8cb5_0
  • ncurses=6.4=hcec6c5f_0
  • nest-asyncio=1.5.6=py311hecd8cb5_0
  • openssl=3.0.12=hca72f7f_0
  • parso=0.8.3=pyhd3eb1b0_0
  • pexpect=4.8.0=pyhd3eb1b0_3
  • pickleshare=0.7.5=pyhd3eb1b0_1003
  • pip=23.3=py311hecd8cb5_0
  • platformdirs=3.10.0=py311hecd8cb5_0
  • prompt-toolkit=3.0.36=py311hecd8cb5_0
  • psutil=5.9.0=py311h6c40b1e_0
  • ptyprocess=0.7.0=pyhd3eb1b0_2
  • pure_eval=0.2.2=pyhd3eb1b0_0
  • pycparser=2.21=pyhd3eb1b0_0
  • pygments=2.15.1=py311hecd8cb5_1
  • pyopenssl=23.2.0=py311hecd8cb5_0
  • pysocks=1.7.1=py311hecd8cb5_0
  • python=3.11.5=hf27a42d_0
  • python-dateutil=2.8.2=pyhd3eb1b0_0
  • pytz=2023.3.post1=py311hecd8cb5_0
  • pyzmq=25.1.0=py311hcec6c5f_0
  • readline=8.2=hca72f7f_0
  • requests=2.31.0=py311hecd8cb5_0
  • setuptools=68.0.0=py311hecd8cb5_0
  • six=1.16.0=pyhd3eb1b0_1
  • snowballstemmer=2.2.0=pyhd3eb1b0_0
  • sphinx=5.0.2=py311hecd8cb5_0
  • sphinxcontrib-applehelp=1.0.2=pyhd3eb1b0_0
  • sphinxcontrib-devhelp=1.0.2=pyhd3eb1b0_0
  • sphinxcontrib-htmlhelp=2.0.0=pyhd3eb1b0_0
  • sphinxcontrib-jsmath=1.0.1=pyhd3eb1b0_0
  • sphinxcontrib-qthelp=1.0.3=pyhd3eb1b0_0
  • sphinxcontrib-serializinghtml=1.1.5=pyhd3eb1b0_0
  • spyder-kernels=2.4.4=py311hecd8cb5_0
  • sqlite=3.41.2=h6c40b1e_0
  • stack_data=0.2.0=pyhd3eb1b0_0
  • tk=8.6.12=h5d9f67b_0
  • tornado=6.3.3=py311h6c40b1e_0
  • traitlets=5.7.1=py311hecd8cb5_0
  • wcwidth=0.2.5=pyhd3eb1b0_0
  • wheel=0.41.2=py311hecd8cb5_0
  • wurlitzer=3.0.2=py311hecd8cb5_0
  • xz=5.4.2=h6c40b1e_0
  • zeromq=4.3.4=h23ab428_0
  • zlib=1.2.13=h4dc903c_0
  • pip:
    • attrs==23.1.0
    • bagit==1.8.1
    • beautifulsoup4==4.12.2
    • bibtexparser==1.4.1
    • bleach==6.1.0
    • cartopy==0.22.0
    • chardet==5.2.0
    • charset-normalizer==3.3.2
    • comm==0.2.0
    • contourpy==1.2.0
    • cycler==0.12.1
    • defusedxml==0.7.1
    • demjson3==3.0.6
    • dill==0.3.7
    • doi2bib==0.4.0
    • fastjsonschema==2.19.0
    • fonttools==4.44.3
    • future==0.18.3
    • ipywidgets==8.1.1
    • isodate==0.6.1
    • joblib==1.3.2
    • jsonschema==4.20.0
    • jsonschema-specifications==2023.11.1
    • jupyter-sphinx==0.4.0
    • jupyterlab-pygments==0.2.2
    • jupyterlab-widgets==3.0.9
    • kiwisolver==1.4.5
    • kneed==0.8.5
    • latexcodec==2.0.1
    • lipd==0.2.8.8
    • llvmlite==0.41.1
    • matplotlib==3.8.2
    • mistune==3.0.2
    • multiprocess==0.70.15
    • nbclient==0.9.0
    • nbconvert==7.11.0
    • nbformat==5.9.2
    • nbsphinx==0.9.3
    • nitime==0.10.2
    • numba==0.58.1
    • numpy==1.23.5
    • numpydoc==1.6.0
    • packaging==23.2
    • pandas==2.1.3
    • pandocfilters==1.5.0
    • pathos==0.3.1
    • patsy==0.5.3
    • pillow==10.1.0
    • ply==3.11
    • pox==0.3.3
    • ppft==1.7.6.7
    • pybtex==0.24.0
    • pyhht==0.1.0
    • pylipd==1.3.6
    • pyparsing==3.1.1
    • pyproj==3.6.1
    • pyshp==2.3.1
    • pyyaml==6.0.1
    • rdflib==7.0.0
    • readthedocs-sphinx-search==0.3.1
    • referencing==0.31.0
    • rpds-py==0.13.0
    • scikit-learn==1.3.2
    • scipy==1.11.3
    • seaborn==0.12.2
    • shapely==2.0.2
    • sip==6.7.12
    • soupsieve==2.5
    • sphinx-copybutton==0.5.2
    • sphinx-rtd-theme==1.3.0
    • sphinxcontrib-jquery==4.1
    • statsmodels==0.14.0
    • tabulate==0.9.0
    • tftb==0.1.4
    • threadpoolctl==3.2.0
    • tinycss2==1.2.1
    • tqdm==4.66.1
    • tzdata==2023.3
    • unidecode==1.3.7
    • urllib3==2.1.0
    • webencodings==0.5.1
    • wget==3.2
    • widgetsnbextension==4.0.9
    • xlrd==2.0.1
@mwaskom
Copy link
Owner

mwaskom commented Nov 29, 2023

Can you please craft a reproducible example that uses seaborn directly? It's going to be necessary to understand how your library is using seaborn to make any sense of what might be happening here, and you're going to be in a much better position to do that than I am.

@CommonClimate
Copy link
Author

Yes, I'll be happy to. The student who wrote that part of our code is currently sick, but when they get better I will work with them to pare down the code and provide a seaborn-only MWE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants