pip install matplotlib
# 从matplotlib套件载入类别pyplot
from matplotlib import pyplot as plt
# x轴为1~12月份
x = range(1,13)
# y轴为各月份最高温度
y = [22, 21, 22, 25, 26, 28, 29, 31, 30, 29, 26, 24]
# 图表标题
plt.title("1 year temp")
# x轴标题
plt.xlabel("month")
# y轴标题
plt.ylabel("temp")
# 绘制图表
plt.plot(x, y)
# 显示图表
plt.show()
长的像这样
# 从matplotlib套件载入类别pyplot
from matplotlib import pyplot as plt
# x轴为1~12月份
x = range(1,13)
# y轴为各月份最高温度
y = [22, 21, 22, 25, 26, 28, 29, 31, 30, 29, 26, 24]
# 图表标题
plt.title("1 year temp")
# x轴标题
plt.xlabel("month")
# y轴标题
plt.ylabel("temp")
# 绘制图表
plt.plot(x, y, "ob")
# 显示图表
plt.show()
# 从matplotlib套件载入类别pyplot
from matplotlib import pyplot as plt
# x轴为1~12月份
x = range(1,13)
# y轴为各月份最高温度
y = [22, 21, 22, 25, 26, 28, 29, 31, 30, 29, 26, 24]
# 图表标题
plt.title("1 year temp")
# x轴标题
plt.xlabel("month")
# y轴标题
plt.ylabel("temp")
# 绘制图表
plt.bar(x, y)
# 显示图表
plt.show()
# 从matplotlib套件载入类别pyplot
from matplotlib import pyplot as plt
# x轴为1~12月份
x = range(1,13)
# y1为各月份平均温度
y1 = [22, 21, 22, 25, 26, 28, 29, 31, 30, 29, 26, 24]
# y2为各月份最高温度
y2 = [23, 25, 26, 28, 29, 31, 30, 28, 26, 24, 22, 20]
# 图表标题
plt.title("1 year temp")
# x轴标题
plt.xlabel("month")
# y轴标题
plt.ylabel("temp")
# 绘制图表
plt.plot(x, y1)
# 第二条线
plt.plot(x, y2)
# 显示图表
plt.show()
# 从matplotlib套件载入类别pyplot
from matplotlib import pyplot as plt
# x轴为1~12月份
x = range(1,13)
# y1为各月份平均温度
y1 = [22, 21, 22, 25, 26, 28, 29, 31, 30, 29, 26, 24]
# y2为各月份最高温度
y2 = [23, 25, 26, 28, 29, 31, 30, 28, 26, 24, 22, 20]
# 图表标题
plt.title("1 year temp")
# x轴标题
plt.xlabel("month")
# y轴标题
plt.ylabel("temp")
# 绘制图表
plt.bar(x, y1, color = "gray")
# 第二条线
plt.plot(x, y2, color = "red")
plt.plot(x, y2, "o", color = "yellow" )
# 显示图表
plt.show()
# 从matplotlib套件载入类别pyplot
from matplotlib import pyplot as plt
# x轴为1~12月份
x = range(1,13)
# y1为各月份平均温度
y1 = [22, 21, 22, 25, 26, 28, 29, 31, 30, 29, 26, 24]
# y2为各月份最高温度
y2 = [23, 25, 26, 28, 29, 31, 30, 28, 26, 24, 22, 20]
# 图表标题
plt.title("1 year temp")
# x轴标题
plt.xlabel("month")
# y轴标题
plt.ylabel("temp")
# 绘制图表
l1 = plt.plot(x, y1, color = "gray", label = "AVG")
# 第二条线
l2 = plt.plot(x, y2, color = "red", label = "MAX")
#增加图例
plt.legend(loc='upper right')
# 显示图表
plt.show()
昨天聊到小五郎叔叔脖子上的伤痕,今天要来聊日本的国民漫画航海王,大家有看过航海王的话想必对我们的主角...
第二天,不废话,继续摸摸摸。 ProtoPie 的 Conceptual model 影片开始解释 ...
今天来练习第一个Dialog AlertDialog AlertDialog不仅仅提供使用者显示文字...
滚动组件 滚动组件是具有可滚动(Scroll)效果的内容区块,可以透过滚动的方式提供更多可浏览的内容...
今天介绍使用 GRU 进行时间序列预测,一样采用我们最爱的股价资料集!! 今日大纲 GRU 介绍 门...