bb62b33640b7ecb9f5259fe94fa2b7368bd0d85c,scanpy/plotting/_utils.py,,adjust_palette,#Any#Any#,263
Before Change
islist = False
if isinstance(palette, list):
islist = True
if ((islist and len(palette) < length)
or (not isinstance(palette, list) and len(palette.by_key()["color"]) < length)):
if length <= 28:
palette = palettes.default_26
elif length <= len(palettes.default_64): // 103 colors
palette = palettes.default_64
else:
palette = ["grey" for i in range(length)]
logg.info("more than 103 colors would be required, initializing as "grey"")
return palette if islist else cycler(color=palette)
elif islist:
return palette
elif not isinstance(palette, Cycler):
return cycler(color=palette)
else:
return palette
def add_colors_for_categorical_sample_annotation(adata, key, palette=None, force_update_colors=False):
if key + "_colors" in adata.uns and not force_update_colors:
if len(adata.obs[key].cat.categories) > len(adata.uns[key + "_colors"]):
logg.info(
After Change
def adjust_palette(palette: Union[Cycler, ListedColormap, Sequence[ColorLike]], length: int):
if isinstance(palette, cabc.Sequence):
length_pal = len(palette)
elif isinstance(palette, Cycler):
length_pal = len(palette.by_key()["color"])
elif isinstance(palette, ListedColormap):
length_pal = len(palette.colors)
else:
raise ValueError(f"Unknown palette type {type(palette)}")
if length_pal < length:
if length <= 28:
palette = palettes.default_26
elif length <= len(palettes.default_64): // 103 colors
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 9
Instances
Project Name: theislab/scanpy
Commit Name: bb62b33640b7ecb9f5259fe94fa2b7368bd0d85c
Time: 2019-09-14
Author: flying-sheep@web.de
File Name: scanpy/plotting/_utils.py
Class Name:
Method Name: adjust_palette
Project Name: IBM/adversarial-robustness-toolbox
Commit Name: dcb57098b660bc7ccc0d225798be1c4380353be4
Time: 2020-05-28
Author: hesseltuinhof@users.noreply.github.com
File Name: art/estimators/classification/tensorflow.py
Class Name: TensorFlowV2Classifier
Method Name: __init__
Project Name: arraiy/torchgeometry
Commit Name: 6ee3f1b0d2a6ebadc9e2f664354594342ab0805d
Time: 2020-11-21
Author: justanhduc@users.noreply.github.com
File Name: kornia/augmentation/augmentation.py
Class Name: RandomSolarize
Method Name: __init__
Project Name: snorkel-team/snorkel
Commit Name: 8a55bc7c982d291c9698d979c2e14bc79d396cd7
Time: 2019-08-13
Author: hancock.braden@gmail.com
File Name: snorkel/classification/models/advanced/advanced_classifier.py
Class Name: AdvancedClassifier
Method Name: forward