Skip to content

Instantly share code, notes, and snippets.

@joaomacalos
Created May 1, 2021 14:14
Show Gist options
  • Select an option

  • Save joaomacalos/66a9e77a3d6f0bfd88b03049cddce1f9 to your computer and use it in GitHub Desktop.

Select an option

Save joaomacalos/66a9e77a3d6f0bfd88b03049cddce1f9 to your computer and use it in GitHub Desktop.
hashtag11-waffle
from pywaffle import Waffle
data = {'In favor (99)': 99/50, 'Against (7436)': 7436/50}
fig = plt.figure(
FigureClass=Waffle,
rows=10,
values=data,
colors=("#5b9aa0", "#e06377"),
title={'label': 'SupearLeague hashtags \n \n',
'loc': 'left',
'fontdict': {
'fontsize': 15
}},
legend={'loc': 'lower left',
'bbox_to_anchor': (0, -0.4),
'ncol': len(data),
'framealpha': 0,
'fontsize': 10},
dpi=250,
figsize=(6,4)
)
fig.text(
x=0.23,
y=0.27,
s="Each square represents ~50 tweets",
ha="center",
va="center",
fontsize=6,
color='gray',
alpha=1,
bbox={
'boxstyle': 'square',
'lw': 3,
'ec': 'gray',
'fc': (0.1, 0.1, 0.1, 0.1),
'alpha': 0
}
)
plt.plot(0.448,0.035,color='grey', marker='.')
plt.plot([0.448, 0.448], [0, 0.035], '-', lw=1, color='grey')
plt.figtext(0.02, .825,
'''There were 7535 tweets with opinionated hashtags
\nabout the #SuperLeague on April 19th, 2021''',
fontsize=8,
ha='left');
# fig.savefig('waffle.png')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment