Currently the colors are assigned when loading the transcript viewer, which lowers performance and can lead to duplicate colors when displaying multiple transcripts. It might make more sense to predefine a large set of optimized colors and use those. The glasbey package does this for large number of colors. One could once generate a list of hexcolors and save them somewhere in the package instead of generating them in situ.
Glasbey default:
import glasbey
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
colors = glasbey.create_palette(palette_size=20)
fig, ax = plt.subplots(figsize=(10, 1))
for i, c in enumerate(colors):
ax.add_patch(mpatches.Rectangle((i, 0), 1, 1, color=c))
ax.set_xlim(0, len(colors))
ax.set_ylim(0, 1)
ax.axis('off')
plt.tight_layout()
plt.show()
Shiny colors:
import glasbey
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
colors = glasbey.create_palette(
palette_size=20,
lightness_bounds=(30, 70),
chroma_bounds=(60, 100),
)
fig, ax = plt.subplots(figsize=(10, 1))
for i, c in enumerate(colors):
ax.add_patch(mpatches.Rectangle((i, 0), 1, 1, color=c))
ax.set_xlim(0, len(colors))
ax.set_ylim(0, 1)
ax.axis('off')
plt.tight_layout()
plt.show()
Currently the colors are assigned when loading the transcript viewer, which lowers performance and can lead to duplicate colors when displaying multiple transcripts. It might make more sense to predefine a large set of optimized colors and use those. The
glasbeypackage does this for large number of colors. One could once generate a list of hexcolors and save them somewhere in the package instead of generating them in situ.Glasbey default:
Shiny colors: