File: plot_5_unicode_everywhere.py

package info (click to toggle)
sphinx-gallery 0.19.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,336 kB
  • sloc: python: 10,346; makefile: 216; lisp: 15; sh: 11; cpp: 9
file content (38 lines) | stat: -rw-r--r-- 948 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
"""
Using Unicode everywhere πŸ€—
===========================

This example demonstrates how to include non-ASCII characters, mostly emoji πŸŽ‰
to stress test the build and test environments that parse the example files.
"""

# πŸŽ‰ πŸ‘
# Code source: Γ“scar NΓ‘jera
# License: BSD 3 clause

import matplotlib.pyplot as plt
import numpy as np

plt.rcParams["font.size"] = 20
plt.rcParams["font.monospace"] = ["DejaVu Sans Mono"]
plt.rcParams["font.family"] = "monospace"

plt.figure()
x = np.random.randn(100) * 2 + 1
y = np.random.randn(100) * 6 + 3
s = np.random.rand(*x.shape) * 800 + 500
plt.scatter(x, y, s, marker=r"$\oint$")
x = np.random.randn(60) * 7 - 4
y = np.random.randn(60) * 3 - 2
s = s[: x.size]
plt.scatter(x, y, s, alpha=0.5, c="g", marker=r"$\clubsuit$")
plt.xlabel("β‡’")
plt.ylabel("β‡’")
plt.title("β™²" * 10)
print("Std out capture 😎")
# To avoid matplotlib text output
plt.show()

# %%
# Debug fonts
print(plt.rcParams)