alan-turing-institute/distinctipy

MANUALLY RE-ORDER COLORS FROM CREATED DISTINCT COLORS

Docetom opened this issue · 2 comments

Please How can I extract the distinct colors created and use them continuously such that it does not change when I re-run the code. This is because I need specific colors to be repeated. e.g in_cols = [black,black,black,blue,blue,blue ...etc]

I have tried the following but it seems not to work.
in_colors = [#2b1f53,#2b1f53,#2b1f53,#00ff00,#f300e8,#0080ff,#ff8000,#80bf80,#3702a4,#c1022d,
#0c7f17,#2dfef8,#e17eff,#ffff00,#00ff80,#8658a6,#096585,#85ad00,#f5b38a,#653b0e,
#75abfd,#8000ff,#fe417a,#0000ff,#21aeb0,#a3ff38,#9cfafd,#ac6d47,#2fc842,#b21299,#ffff80,#5249fb]
d=distinctipy.get_colors(in_colors)

Resolved. Thanks

In case it helps someone else, distinctipy.get_colors has an argument rng that can be used to set a fixed random seed and guarantee the same results each time. Alternatively, there's the list of 200 colours that's built-in to distinctipy, or you can save the colours to file and reload. I probably should add functionality to save/load colours nicely.