Spaces:
Running
Running
File size: 581 Bytes
714c84b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import os
import matplotlib.pyplot as plt
import matplotlib.font_manager as fm
# Install Japanese fonts
os.system("apt-get update && apt-get install -y fonts-noto-cjk")
# Set font path and apply
font_path = "/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc"
if os.path.exists(font_path):
font_prop = fm.FontProperties(fname=font_path)
plt.rcParams["font.family"] = font_prop.get_name()
print(f"β
Japanese font applied: {font_prop.get_name()}")
else:
print("β Japanese font not found")
font_properties = font_prop if os.path.exists(font_path) else None
|