From 991559ef4284103f2523664936a1a98bfb6bda82 Mon Sep 17 00:00:00 2001 From: Janosh Riebesell Date: Thu, 25 Nov 2021 15:40:56 +0000 Subject: [PATCH 1/2] hide axes grid, set scaleanchor='x' for square element tiles, disable hover text on empty fields --- doc/python/annotated-heatmap.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/doc/python/annotated-heatmap.md b/doc/python/annotated-heatmap.md index 1e27c221bb3..fc6ce096c27 100644 --- a/doc/python/annotated-heatmap.md +++ b/doc/python/annotated-heatmap.md @@ -125,7 +125,7 @@ fig.show() #### Custom Hovertext ```python -# Add Periodic Table Data +# Periodic Table Data symbol = [['H', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'He'], ['Li', 'Be', '', '', '', '', '', '', '', '', '', '', 'B', 'C', 'N', 'O', 'F', 'Ne'], ['Na', 'Mg', '', '', '', '', '', '', '', '', '', '', 'Al', 'Si', 'P', 'S', 'Cl', 'Ar'], @@ -181,7 +181,7 @@ z = [[.8, .0, .0, .0, .0, .0, .0, .0, .0, .0, .0, .0, .0, .0, .0, .0, .0, 1.], # Display element name and atomic mass on hover hover=[] for x in range(len(symbol)): - hover.append([i + '
' + 'Atomic Mass: ' + str(j) + hover.append([i + '
' + 'Atomic Mass: ' + str(j) if i else '' for i, j in zip(element[x], atomic_mass[x])]) # Invert Matrices @@ -197,7 +197,12 @@ colorscale=[[0.0, 'rgb(255,255,255)'], [.2, 'rgb(255, 255, 153)'], # Make Annotated Heatmap fig = ff.create_annotated_heatmap(z, annotation_text=symbol, text=hover, colorscale=colorscale, font_colors=['black'], hoverinfo='text') -fig.update_layout(title_text='Periodic Table') +fig.update_layout( + title_text='Periodic Table', + margin=dict(l=10, r=10, t=10, b=10, pad=10), + xaxis=dict(zeroline=False, showgrid=False), + yaxis=dict(zeroline=False, showgrid=False, scaleanchor="x"), +) fig.show() ``` From 3a1f2d8bc9e16bce21bae1381db2fa228bd21d47 Mon Sep 17 00:00:00 2001 From: Janosh Riebesell Date: Fri, 26 Nov 2021 19:34:29 +0000 Subject: [PATCH 2/2] fix whitespace in sunburst example --- doc/python/sunburst-charts.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/python/sunburst-charts.md b/doc/python/sunburst-charts.md index 249dde5783a..521e6d254cb 100644 --- a/doc/python/sunburst-charts.md +++ b/doc/python/sunburst-charts.md @@ -48,7 +48,7 @@ data = dict( parent=["", "Eve", "Eve", "Seth", "Seth", "Eve", "Eve", "Awan", "Eve" ], value=[10, 14, 12, 10, 2, 6, 6, 4, 4]) -fig =px.sunburst( +fig = px.sunburst( data, names='character', parents='parent',