You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Version (Anaconda): drep 3.5.0 pyhdfd78af_0 bioconda
First of all, thanks for your work, dRep has been very useful in my work.
One thing that could be improved is the use of colors in the text of the dendrograms, some of them have very low contrast against white. According to https://webaim.org/resources/contrastchecker/ is recommendable that the text have at least a 4.5 contrast ratio with the background. Here is an image that shows the contrast ratio of the used colors (I think that you are using the jet colormap):
This could be solved by choosing other colors for the text but I think that a simpler solution is to use a circle filled with the color next to text, something like this:
For comparison:
Code used for the contrast image:
importmatplotlib.pyplotaspltimportmatplotlib.colorsasmcimportnumpyasnpimporthttpximportasynciofromdataclassesimportdataclass@dataclass(slots=True)classColors:
fg: strbg: strcontrast: float|None=Noneasyncdefadd_contrast(session, colors):
try:
url=f"https://webaim.org/resources/contrastchecker/?fcolor={mc.rgb2hex(colors.fg)[1:]}&bcolor={mc.rgb2hex(colors.bg)[1:]}&api"response=awaitsession.get(url)
response.raise_for_status()
colors.contrast=float(response.json()["ratio"])
excepthttpx.HTTPStatusErrorase:
print(f"Error in the request: {e.response.status_code} for URL {url}")
asyncdefadd_contrasts(colors_list):
asyncwithhttpx.AsyncClient() assession:
tasks= []
forcolorsincolors_list:
task=asyncio.create_task(add_contrast(session, colors))
tasks.append(task)
awaitasyncio.gather(*tasks)
asyncdefget_colors_list(colormap):
vals=np.linspace(0,1,20)
#np.random.shuffle(vals)white= (1, 1, 1)
colors_list=list(map(lambdac: Colors(c, white), colormap(vals)))
awaitadd_contrasts(colors_list)
returncolors_listdefplot_contrasts(colors_list):
fig, ax=plt.subplots(figsize=(4, 4))
ax.axis('off')
length=len(colors_list)
fori, colorsinenumerate(colors_list):
plt.figtext(0, i/length, colors.contrast, color="black")
plt.figtext(0.1, i/length, "The quick brown fox jumps over the lazy dog", color=colors.fg)
plt.show()
colors_list_jet=awaitget_colors_list(plt.cm.jet)
plot_contrasts(colors_list_jet)
The text was updated successfully, but these errors were encountered:
Thanks for sharing. Agree, this is a great idea. Will add it to my "To Do" list, and will happily accept a pull request if someone else implements as well.
Version (Anaconda): drep 3.5.0 pyhdfd78af_0 bioconda
First of all, thanks for your work, dRep has been very useful in my work.
One thing that could be improved is the use of colors in the text of the dendrograms, some of them have very low contrast against white. According to https://webaim.org/resources/contrastchecker/ is recommendable that the text have at least a 4.5 contrast ratio with the background. Here is an image that shows the contrast ratio of the used colors (I think that you are using the jet colormap):
This could be solved by choosing other colors for the text but I think that a simpler solution is to use a circle filled with the color next to text, something like this:
For comparison:
Code used for the contrast image:
The text was updated successfully, but these errors were encountered: