scanpy icon indicating copy to clipboard operation
scanpy copied to clipboard

Add support for passing boolean columns in .obs when plotting clustermap or dendrogram.

Open Imipenem opened this issue 2 years ago • 0 comments

  • [x] Additional function parameters / changed functionality / changed defaults?
  • [ ] New analysis tool: A simple analysis tool you have been using and are missing in sc.tools?
  • [ ] New plotting function: A kind of plot you would like to seein sc.pl?
  • [ ] External tools: Do you know an existing package that should go into sc.external.*?
  • [ ] Other?

Hey, currently, when trying to use plotting functions that require categorical obs columns (for example sc.pl.clustermap obs_keys parameter), but one passes a boolean column key in .obs, scanpy will raise an error (or pandas does but the origin is in scanpy's codebase): AttributeError: Can only use .cat accessor with a 'category' dtype.

Would it be possible to let the passed key be from a column of dtype bool as well? Are there any downsides? Happy to provide more detail if needed.

Imipenem avatar May 02 '22 19:05 Imipenem