1

I have the following dictionary:

{'❤': 10, '‍‍‍': 23, '': 13, '': 10, '': 13}

I want to plot the emojis as a bar, and draw them on the bar. At first I did like here (with annotate), but it looks bad, and it doesn't support some emojis.

import matplotlib.pyplot as plt
ax = plt.subplot(111)
ax.bar(range(1,6), a.values())
for label, x, y in zip(a.keys(), range(1,6), a.values()):
    plt.annotate(
        label, 
        xy=(x, y), xytext=(10,10),
        textcoords='offset points', ha='right', va='bottom',
        bbox=dict(boxstyle='round,pad=0.5', alpha=0),
        fontname='Segoe UI Emoji',
        fontsize=20)

ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False)
ax.set_xticks([])
plt.show()

As I said, looks bad:

enter image description here

I tried to ask how to plot high quality emojis, but didn't get an answer. How can I plot the emojis such that they will look good? I don't want to start web scraping the images and labeling them (because I'm pretty sure someone already did it). I'm using python 3.

Any suggestions?

sheldonzy
  • 5,505
  • 9
  • 48
  • 86
  • If this is about not getting an answer, you may use [a bounty](https://stackoverflow.com/help/bounty). But make sure your question is well posed, i.e. contains in how far it is different from other questions on this topic, includes your system and relevant package versions etc. – ImportanceOfBeingErnest Mar 08 '18 at 11:32
  • 1
    I think the problem here lies in the font Matplotlib is using. Try changing the font using the RcParams in Matplotlib – Yngve Moe Mar 10 '18 at 08:40
  • @ImportanceOfBeingErnest - I decided to put a bounty on the previous question (that I edited now) considering the larger amount of views. I want to delete this question, but I can't because https://stackoverflow.com/q/47102873/7252805 is a duplicate of this one. Can you please open this question so I can delete this question? – sheldonzy Mar 10 '18 at 16:56

0 Answers0