我想在一张照片中绘制3个功能,但第三个功能无法获取,我的代码是否有任何内容?
x = np.arange(-10., 10., 0.2)
simod1=sigmoid(x)
tanh1=tanh1(x)
relu1=relu(x)
pl.figure(num=1, figsize=(8, 6))
pl.title('Plot 1', size=14)
pl.xlabel('x-axis', size=14)
pl.ylabel('y-axis', size=14)
pl.plot(x, simod1, color='b', linestyle='--', marker='o', label='sigmoid')
pl.plot(x, tanh1, color='r', linestyle='-', label='tanh')
pl.plot(x, relu1, color='y', linestyle='*', label='relu')
pl.legend(loc='upper left')
pl.savefig('temp.png', format='png')
答案 0 :(得分:1)
'*'
无效linestyle
,请参阅文档http://matplotlib.org/api/lines_api.html#matplotlib.lines.Line2D.set_linestyle
我想你想这样做:
plt.plot(x, simod1, 'o--', color='b', label='sigmoid')
plt.plot(x, tanh1, '-', color='r', label='tanh')
plt.plot(x, relu1, '*', color='y', label='relu')