Created
January 3, 2017 10:21
-
-
Save Adagio-cantabile/ee7b8213e2e3f34fb997a04515f7a133 to your computer and use it in GitHub Desktop.
pyplot绘图
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 matplotlib | |
import numpy as np | |
import random | |
#针对图片显示不了中文的问题,向matplotlib添加字库 | |
#Mac 字体一般在/Library/Fonts/下 | |
#Linux的字体一般在/usr/share/fonts/下 | |
zhfont1 = matplotlib.font_manager.FontProperties(fname='/Library/Fonts/华文仿宋.ttf') | |
cache_nonhit_64 = [3.43, 0.15, 0.15,0.15, 0.15,0.15] | |
cache_nonhit_256 = [0.16, 0.15, 0.15,0.15,0.15,0.15] | |
association = [1,2,4,8,16,32] | |
plt.xlabel('相联度', fontproperties = zhfont1) | |
plt.ylabel('cache不命中率(%)', fontproperties = zhfont1) | |
plot1 = plt.plot(association, cache_nonhit_64, '-ro', label='64K') | |
plot2 = plt.plot(association, cache_nonhit_256, '-bx', label='256K') | |
plt.legend(['64K', '256K']) | |
plt.title('cache不命中率与相连度的关系\ntex.din', fontproperties = zhfont1) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment