Python Daily
2.57K subscribers
1.48K photos
53 videos
2 files
38.9K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
Matplotlib Scatterplots, but with Emojis as Markers

I wrote a function to create scatterplots using emojis as markers to support some analysis & visualization I'm doing for a (very silly) side project. After a good bit of research (I was pretty shocked this didn't exist already), I built this based on [this article](https://towardsdatascience.com/how-i-got-matplotlib-to-plot-apple-color-emojis-c983767b39e0), but adapted to produce a scatterplot instead of a bar chart.

#function to create a scatterplot with emojis as markers
#based on https://towardsdatascience.com/how-i-got-matplotlib-to-plot-apple-color-emojis-c983767b39e0
#follow instructions above to install & build mplcairo

#Set the backend to use mplcairo
import matplotlib, mplcairo
print('Default backend: ' + matplotlib.get_backend())
matplotlib.use("module://mplcairo.macosx")
print('Backend is now ' + matplotlib.get_backend())

# IMPORTANT: Import these libraries only AFTER setting the backend
import matplotlib.pyplot as plt, numpy as np
from matplotlib.font_manager import FontProperties

# Load Apple Color Emoji font
prop = FontProperties(fname='/System/Library/Fonts/Apple Color Emoji.ttc')

# Load Apple Color Emoji font
prop =

/r/Python
https://redd.it/iazdqd