KrishnaswamyLab / scprep

A collection of scripts and tools for loading, processing, and handling single cell data.
MIT License
72 stars 21 forks source link

Unable to turn off axis labels when passing dataframe to scatter2d #96

Closed dburkhardt closed 4 years ago

dburkhardt commented 4 years ago
import numpy as np
import pandas as pd
import scprep

data = pd.DataFrame(np.random.normal(size=(100,2)), columns=['A', 'B'])
scprep.plot.scatter2d(data, label_prefix=False)

raises

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-153-83554e2a7db2> in <module>
      4 
      5 data = pd.DataFrame(np.random.normal(size=(100,2)), columns=['A', 'B'])
----> 6 scprep.plot.scatter2d(data, label_prefix=False)

</usr/lib/python3.8/site-packages/decorator.py:decorator-gen-144> in scatter2d(data, c, cmap, cmap_scale, s, mask, discrete, ax, legend, colorbar, shuffle, figsize, ticks, xticks, yticks, ticklabels, xticklabels, yticklabels, label_prefix, xlabel, ylabel, title, fontsize, legend_title, legend_loc, legend_anchor, filename, dpi, **plot_kwargs)

~/.local/lib/python3.8/site-packages/scprep/utils.py in _with_pkg(fun, pkg, min_version, *args, **kwargs)
     81         check_version(pkg, min_version=min_version)
     82         __imported_pkgs.add((pkg, min_version))
---> 83     return fun(*args, **kwargs)
     84 
     85 

~/.local/lib/python3.8/site-packages/scprep/plot/scatter.py in scatter2d(data, c, cmap, cmap_scale, s, mask, discrete, ax, legend, colorbar, shuffle, figsize, ticks, xticks, yticks, ticklabels, xticklabels, yticklabels, label_prefix, xlabel, ylabel, title, fontsize, legend_title, legend_loc, legend_anchor, filename, dpi, **plot_kwargs)
    939     if isinstance(data, list):
    940         data = utils.toarray(data)
--> 941     return scatter(
    942         x=select.select_cols(data, idx=0),
    943         y=select.select_cols(data, idx=1),

</usr/lib/python3.8/site-packages/decorator.py:decorator-gen-143> in scatter(x, y, z, c, cmap, cmap_scale, s, mask, discrete, ax, legend, colorbar, shuffle, figsize, ticks, xticks, yticks, zticks, ticklabels, xticklabels, yticklabels, zticklabels, label_prefix, xlabel, ylabel, zlabel, title, fontsize, legend_title, legend_loc, legend_anchor, vmin, vmax, elev, azim, filename, dpi, **plot_kwargs)

~/.local/lib/python3.8/site-packages/scprep/utils.py in _with_pkg(fun, pkg, min_version, *args, **kwargs)
     81         check_version(pkg, min_version=min_version)
     82         __imported_pkgs.add((pkg, min_version))
---> 83     return fun(*args, **kwargs)
     84 
     85 

~/.local/lib/python3.8/site-packages/scprep/plot/scatter.py in scatter(x, y, z, c, cmap, cmap_scale, s, mask, discrete, ax, legend, colorbar, shuffle, figsize, ticks, xticks, yticks, zticks, ticklabels, xticklabels, yticklabels, zticklabels, label_prefix, xlabel, ylabel, zlabel, title, fontsize, legend_title, legend_loc, legend_anchor, vmin, vmax, elev, azim, filename, dpi, **plot_kwargs)
    742             _with_default(xticks, ticks),
    743             _with_default(xticklabels, ticklabels),
--> 744             params.xlabel,
    745         )
    746         label_axis(

~/.local/lib/python3.8/site-packages/scprep/plot/scatter.py in xlabel(self)
    513             return self._xlabel
    514         elif self._label_prefix is not None:
--> 515             return self._label_prefix + "1"
    516         elif isinstance(self._x, pd.Series):
    517             return self._x.name

TypeError: unsupported operand type(s) for +: 'bool' and 'str'

and

import numpy as np
import pandas as pd
import scprep

data = pd.DataFrame(np.random.normal(size=(100,2)), columns=['A', 'B'])
scprep.plot.scatter2d(data, xlabel=False)

produces:

image