Plotting emojis
código
Resumen de un googleo interminable
Recently I needed to combine a line chart with an emoji. I googled until exhaustion, but the solutions didn’t work correctly for me. After trying tons of options, the code that did work for me was the following:
def plot_emoji(emoji_path, ax, x, y, zoom=0.35):
"""
Plots an emoji on a figure.
Based on:
https://www.geeksforgeeks.org/emojis-as-markers-in-matplotlib/
image_path: path to the image
ax: axis to plot on
x: x coordinate
y: y coordinate
zoom: zoom factor (resizing)
"""
# reading the image
image = plt.imread(emoji_path)
# OffsetBox
image_box = OffsetImage(image, zoom=zoom)
# Drawing the image
ab = AnnotationBbox(image_box, (x, y), frameon=False)
ax.add_artist(ab)
returnIt doesn’t let you use an emoji directly, but it does work for any image.