Created
August 25, 2021 20:56
-
-
Save russelllim22/ed4e2846f397c77e264038b9f5e42844 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import plotly.graph_objects as go | |
fig2 = go.Figure( | |
data=[go.Pie( | |
labels=['Self-published','Top 10 Pubs.','Other Pubs.'], | |
values=[self_pub_count, top_ten_count, other_pubs_count], # these are counts generated from my data | |
marker=dict( | |
colors=['rgba(235, 141, 0, 0.75)', 'rgba(0, 45, 168, 0.5)', 'rgba(29, 122, 246,0.25)'], | |
line=dict(color='rgba(0, 45, 168, 1)', width=3) # style the pie sectors | |
), | |
insidetextorientation="horizontal", | |
textposition='outside', | |
textfont_color=['rgba(235, 141, 0, 1)', 'rgba(0, 45, 168, 1)', 'rgba(29, 122, 246, 1)'], | |
sort=False # without this line, Plotly defaults to sorting sectors in order of size | |
)] | |
) | |
fig2.update_layout( | |
showlegend=False, | |
title= "Math", | |
title_font_family="Arial Black", | |
title_font_size=30, | |
title_x=0.5,) # center title | |
fig2.write_image("images/Math-pie.png") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment