我希望能够在我的Flask Web项目中可视化绘图(使用SciView)
以下是我的代码:
import matplotlib.pyplot as plt
# x-coordinates of left sides of bars
left = [1, 2, 3, 4, 5]
# heights of bars
height = [10, 24, 36, 40, 5]
# labels for bars
tick_label = ['one', 'two', 'three', 'four', 'five']
# plotting a bar chart
plt.bar(left, height, tick_label=tick_label, width=0.8, color=['red', 'green'])
# naming the y-axis
plt.xlabel('y - axis')
# naming the x-axis
plt.xlabel('x - axis')
# plot title
plt.title('My bar chart!')
# function to show the plot
plt.show()
我尝试在我的Flask项目中运行此代码,但没有输出。
条形图左侧的 x 坐标
left = [1, 2, 3, 4, 5]条形图高度
height = [10, 24, 36, 40, 5]条形图标签
tick_label = ['one', 'two', 'three', 'four', 'five']绘制条形图
plt.bar(left, height, tick_label=tick_label, width=0.8, color=['red', 'green'])命名 x 轴
plt.xlabel('x - axis')命名 y 轴
plt.ylabel('y - axis')图表标题
plt.title('My bar chart!')显示图表函数
plt.show() - Lamine Sirine格式化
。 - ForceBru