Use tensorflow matplotlib to draw graphics

 Draw a line chart

import numpy as np
import matplotlib.pyplot as plt

x = np.array([1,2,3,4,5,6,7,8])
y = np.array([1,2,3,4,5,6,10,15])
#参数1 x轴
#参数2 y轴
#参数3 颜色
#参数4 线条宽度
plt.plot(x, y, "r", lw=3)
plt.show()

 The effect is as follows

Draw a histogram

x = np.array([1,2,3,4,5,6,7,8])
y = np.array([11,12,13,14,5,6,10,15])
#参数1 x轴
#参数2 y轴
#参数3 柱状图的占宽比
#参数4 套名都
#参数5 颜色
plt.bar(x, y, 0.5, alpha=1, color='b')
plt.show()

The effect is as follows

 

Published 92 original articles · Likes5 · Visitors 10,000+

Guess you like

Origin blog.csdn.net/xfb1989/article/details/105439650