diff --git a/doc/python/annotated-heatmap.md b/doc/python/annotated-heatmap.md index becbc0a8ba8..fac53eb1a41 100644 --- a/doc/python/annotated-heatmap.md +++ b/doc/python/annotated-heatmap.md @@ -159,7 +159,7 @@ fig.show() Here is a fairly contrived example showing how one can display a periodic table with custom text and hover using `ff.create_annotated_heatmap()` (scroll below to see the `px.imshow()` equivalent). ```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'], @@ -220,14 +220,19 @@ colorscale=[[0.0, 'rgb(255,255,255)'], [.2, 'rgb(255, 255, 153)'], # 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])]) - + import plotly.figure_factory as ff # Make Annotated Heatmap fig = ff.create_annotated_heatmap(color[::-1], annotation_text=symbol[::-1], text=hover[::-1], 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() ``` 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',