每天学点IT

Python

pyplot

2019.2.20 基本函数参数总结

plt.plot(x, y, [fmt], label=’ ', linewidth=[int] )

Eg. plt.plot(x ,y, ‘go–’,label=’ BUAA’, linewidth=3,markersize=12 )
Eg.plt.plot(x ,y, label=’ BAYI’)
plot(x,y,color=‘green’,marker=‘o’,linestyle=‘dashed’)

fmt=[color][marker][linestyle]

color
‘b’ | blue
‘g’ | green
‘r’ | red
‘c’ | cyan
‘m’ | magenta
‘y’ | yellow
‘k’ | black
‘w’ | white

marker
‘.’ | 点标记符
‘,’ | 像素标记符
‘o’ | 圆圈标记符
‘v’ | 倒三角标记符
‘^’ | 正三角标记符
‘<’ | 左三角标记符
‘>’ | 右三角标记符
‘1’ | 向下竹蜻蜓
‘2’ | 向上竹蜻蜓
‘3’ | 向左竹蜻蜓
‘4’ | 向右竹蜻蜓
‘s’ | 四边形标记符
‘p’ | 五边形标记符
‘*’ | 星型标记符
‘h’ | 六边形标记符
‘H’ | 六边形标记符
‘+’ | +标记符
‘x’ | x标记符
‘D’ | 菱形标记符
‘d’ | 菱形标记符
‘|’ | 竖线标记符
‘_’ | 横线标记符

linestyle
‘-’ | 实线
‘–’ | 划线
‘-.’ | 点划线
‘:’ | 虚线

2019.3.19 Errorbar

plt.plot(x,y)
plt.errorbar(x,y_meam,yerr=y_std)

import os
import glob
import matplotlib.pyplot as plt
import numpy as np

path=[]
path.append('./result/*, 1, 10.0]')
path.append('./result/*, 1, 40.0]')
path.append('./result/*, 1, 80.0]')
path.append('./result/*, 1, 100.0]')

total = []
name = []
files = []

plt.figure(figsize=(15,10))
plt.grid(True, linestyle = "-.", color = "k")
plt.title('Vth_mean=0.0064 Vth_std=0.0017', loc='left')

for i in range (len(path)):
    a=[]
    a1=[]
    files = glob.glob(path[i])


    for file in files:
            count=[]
            f=open(file, 'r')   #ind[1] is direction/ ind[0] is the number of index
            next(f)
            next(f)
            next(f)
            n=0
            for line in f:
                    if n==300:  #modified
                        break
                    n+=1
                    count.append(n)
                    a1.append(float(str(line).split(" ")[3].strip()))
    #observe a--
            f.close()
            a.append(a1)
            a1=[]   #ai is temporary list

    name=str(file).split(",")[-1][:-1]
    a_np=np.array(a)
    a_mean=np.mean(a_np,axis=0)
    a_std=np.std(a_np,axis=0)
    num=np.linspace(0,299,300)

    plt.errorbar(num, a_mean,yerr=a_std,label=name)
    plt.ylabel('Accuracy (%)', size=14)
    plt.xlabel('Epoch', size=14)
    name=[]

    plt.legend(loc='lower right', fontsize='large')
    plt.ylim((0, 1.0))
    #print(num)
    #print(type(a_mean))
    #print(a_mean)

plt.show()

Neuron simulator

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值