Created
May 5, 2019 01:42
-
-
Save corvofeng/4a43ae62717427ac07ef20776764823c to your computer and use it in GitHub Desktop.
Python使用matplotlib画图时显示中文
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import numpy as np | |
import math | |
plt.rcParams['font.sans-serif'] = ['SimHei'] # 用来正常显示中文标签 | |
plt.rcParams['axes.unicode_minus'] = False # 用来正常显示负号 | |
x = np.arange(0, 10, 0.1) | |
y = 2**x | |
plt.title("指数函数") | |
plt.plot(x, y) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment