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
Video Understanding if name == 'main' in Python in 2 Minutes

In this quick 2-minute video, we'll demystify a fundamental concept in Python programming that's often a source of confusion for newcomers and even some experienced developers.

We'll explore the purpose and practical application of the if __name__ == '__main__' construct in Python scripts. No jargon, just clear explanations to help you gain a solid understanding of how this simple line of code can make your Python scripts more organized and versatile.

Video Link: https://youtu.be/WfPwvUjIZtE?si=ODo0DYZq51s\_nVct

If you have any suggestions or feedback, then don't hesitate.

/r/Python
https://redd.it/17rflks