python -matplotlib

from matplotlib import pyplot as plt
from matplotlib import style
style.use('ggplot')#設定背景
x = [1,2,3,4,5,6,7,8,9]
y = [18,21,4,3,45,17,16,5,6]
x2 = [1,2,3,4,5,6,7,8,9]
y2 = [17,28,14,16,15,13,1,5,6]

plt.subplot(211)#有2個圖表,第1個顯示在第1位
plt.plot(x,y,linewidth=3,marker='o',label='truthValue')
plt.plot(x2,y2,color='y',label='prediction')
plt.legend()

plt.subplot(212)#有2個圖表,第1個顯示在第2位
plt.bar(x,y,align='center',label='truthValue')
plt.bar(x2,y2,align='center',label='prediction')#marker轉折點符號
plt.legend()

plt.ylabel('price')
plt.xlabel('date')
plt.show()


Comments

Popular posts from this blog

Go-VSCode -Autocomplete and Auto-import

Dart syntax - initSate,Build,deactive, Dispose