Download utils/visualizations.py from WellmatixGenAI/tp53-mutant-discovery: direct link, hf CLI and curl.
- Browser
- Download file 1.74 kB
-
https://huggingface.co/spaces/WellmatixGenAI/tp53-mutant-discovery/resolve/main/utils/visualizations.py
- Command line
-
hf download hf://spaces/WellmatixGenAI/tp53-mutant-discovery/utils/visualizations.py
-
curl -L -o visualizations.py https://huggingface.co/spaces/WellmatixGenAI/tp53-mutant-discovery/resolve/main/utils/visualizations.py
1.74 kB
| """Plotly styling helpers.""" | |
| COLORS = { | |
| "navy": "#1B365D", | |
| "teal": "#0E7C7B", | |
| "accent": "#C45C26", | |
| "gold": "#D4A017", | |
| "green": "#2F855A", | |
| "red": "#C53030", | |
| "slate": "#4A5568", | |
| "bg": "white", | |
| "text": "#111827", | |
| "tick": "#374151", | |
| "grid": "#E5E7EB", | |
| "axis": "#D1D5DB", | |
| } | |
| PALETTE = [ | |
| "#1B365D", | |
| "#0E7C7B", | |
| "#C45C26", | |
| "#D4A017", | |
| "#2F855A", | |
| "#6B46C1", | |
| "#2B6CB0", | |
| "#C53030", | |
| "#4A5568", | |
| "#319795", | |
| ] | |
| def fmt_fig(fig, h=None): | |
| fig.update_layout( | |
| font=dict(color=COLORS["text"], family="Inter, Arial, sans-serif", size=12), | |
| paper_bgcolor=COLORS["bg"], | |
| plot_bgcolor=COLORS["bg"], | |
| hoverlabel=dict(font=dict(color="#ffffff", size=11), bgcolor=COLORS["navy"]), | |
| legend=dict( | |
| font=dict(color=COLORS["text"], size=11), | |
| bgcolor="rgba(255,255,255,0.88)", | |
| bordercolor=COLORS["grid"], | |
| borderwidth=1, | |
| ), | |
| coloraxis_colorbar=dict( | |
| tickfont=dict(color=COLORS["tick"], size=10), | |
| title_font=dict(color=COLORS["text"], size=11), | |
| ), | |
| margin=dict(l=40, r=20, t=50, b=40), | |
| ) | |
| if h: | |
| fig.update_layout(height=h) | |
| fig.update_xaxes( | |
| tickfont=dict(color=COLORS["tick"], size=11), | |
| title_font=dict(color=COLORS["text"], size=12), | |
| gridcolor=COLORS["grid"], | |
| linecolor=COLORS["axis"], | |
| zerolinecolor=COLORS["grid"], | |
| ) | |
| fig.update_yaxes( | |
| tickfont=dict(color=COLORS["tick"], size=11), | |
| title_font=dict(color=COLORS["text"], size=12), | |
| gridcolor=COLORS["grid"], | |
| linecolor=COLORS["axis"], | |
| zerolinecolor=COLORS["grid"], | |
| ) | |
| return fig | |