This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Median of medians: https://en.wikipedia.org/wiki/Median_of_medians | |
// find median in an unsorted array, worst-case complexity O(n). | |
export const selectMedian = (arr, compare) => { | |
return selectK(arr, Math.floor(arr.length / 2), compare); | |
}; | |
export const selectK = (arr, k, compare) => { | |
if (!Array.isArray(arr) || arr.length === 0 || arr.length - 1 < k) { | |
return; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fig, ax = plt.subplots(figsize=(8, 8)) | |
sc.pl.umap(ds, color="cell_type", legend_loc="on data", size=10, ax=ax, show=False) | |
shrink_by = 0.1 | |
xlim = ax.get_xlim() | |
ylim = ax.get_ylim() | |
xbound = xlim[0] + (xlim[1] - xlim[0]) * shrink_by | |
ybound = ylim[0] + (ylim[1] - ylim[0]) * shrink_by | |
b = ax.spines["bottom"] |