如题所述,以下分享一个用python的matplotlib包画图的时候在图中插入希腊字母的例子,简单说就是用r"$\alpha$=0.8"这样的形式,注意最开始的字母r不能丢。
import json
import matplotlib.pyplot as plt
import matplotlib
#import np
from matplotlib.patches import Ellipse
font = {'size':18}
matplotlib.rc('font', **font)
src1 = "./cdf.caida.20180315-125910.json"
src2 = "./cdf.caida.20180315-130000.json"
src3 = "./cdf.hgc.20080415000.json"
src4 = "./cdf.hgc.20080415001.json"
src5 = "./zipf_dist_1.json"
src6 = "./zipf_dist_2.json"
if __name__ == "__main__":
with open(src1, "r") as f:
[idx1, cdf1] = json.load(f)
with open(src2, "r") as f:
[idx2, cdf2] = json.load(f)
with open(src3, "r") as f:
[idx3, cdf3] = json.load(f)
with open(src4, "r") as f:
[idx4, cdf4] = json.load(f)
with open(src5, "r") as f:
[idx5, cdf5] =