draw python_科学网—Draw figures with Python - 高琳琳的博文
2D histgram
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties
# %matplotlib inline? ? ? #Jupyter notebook在線顯示
plt.bar(['NC'], [0.6], width=0.6, facecolor='#FA8072', label='真實值')
plt.bar(['MCI', 'AD'], [0.25, 0.15], width=0.6, facecolor='#1E90FF', label='非真實值')
# width:條形圖的寬度 默認是0.8
# height:條形圖的高度
# bottom:條形底部的y坐標值 默認是0
# label:為后面設置legend做準備,為legend的名稱
#顏色表可參考網站 https://www.cnblogs.com/darkknightzh/p/6117528.html
myfont = FontProperties('STKAITI', size=14)
plt.legend(prop=myfont)? ? ? #設置legend的字體
plt.xlabel('類別', FontProperties='STKAITI', fontsize=16)
plt.ylabel('概率', FontProperties='STKAITI', fontsize=16)
plt.xticks(FontProperties='Times New Roman', size=12)
plt.yticks(FontProperties='Times New Roman', size=12)
plt.show()
References:?https://blog.csdn.net/hohaizx/article/details/79101322
轉載本文請聯系原作者獲取授權,同時請注明本文來自高琳琳科學網博客。
鏈接地址:http://blog.sciencenet.cn/blog-1969089-1208240.html
上一篇:[轉載]解決Python memory error的問題(四種解決方案)
下一篇:[轉載]國產阿爾茲海默病新藥上市 質疑得到了回應
總結
以上是生活随笔為你收集整理的draw python_科学网—Draw figures with Python - 高琳琳的博文的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: javascript --- vue中
- 下一篇: stc流水灯c语言程序,求51单片机流水