Skip to content

Plot violin throws error when trying to change density argument #3458

Closed
@LinearParadox

Description

@LinearParadox

Please make sure these conditions are met

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of scanpy.
  • (optional) I have confirmed this bug exists on the main branch of scanpy.

What happened?

It seems that plot violin is passing the density argument to seaborne twice

Minimal code sample

sc.pl.violin(adata, groupby="condition", use_raw=False, stripplot=False, keys="pct.mt", density_norm="area")

Error output

File ~/miniconda3/envs/scanpy/lib/python3.10/site-packages/legacy_api_wrap/__init__.py:80, in legacy_api.<locals>.wrapper.<locals>.fn_compatible(*args_all, **kw)
     77 @wraps(fn)
     78 def fn_compatible(*args_all: P.args, **kw: P.kwargs) -> R:
     79     if len(args_all) <= n_positional:
---> 80         return fn(*args_all, **kw)
     82     args_pos: P.args
     83     args_pos, args_rest = args_all[:n_positional], args_all[n_positional:]

File ~/miniconda3/envs/scanpy/lib/python3.10/site-packages/scanpy/plotting/_anndata.py:907, in violin(adata, keys, groupby, log, use_raw, stripplot, jitter, size, layer, scale, order, multi_panel, xlabel, ylabel, rotation, show, save, ax, **kwds)
    905     axs = [ax]
    906 for ax, y, ylab in zip(axs, ys, ylabel):
--> 907     ax = sns.violinplot(
    908         x=x,
    909         y=y,
    910         data=obs_tidy,
    911         order=order,
    912         orient="vertical",
    913         density_norm=scale,
    914         ax=ax,
    915         **kwds,
    916     )
    917     if stripplot:
    918         ax = sns.stripplot(
    919             x=x,
    920             y=y,
   (...)
    926             ax=ax,
    927         )

TypeError: seaborn.categorical.violinplot() got multiple values for keyword argument 'density_norm'

Versions

1.10.1

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions