最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

python3使用matplotlib繪制散點(diǎn)圖

 更新時(shí)間:2019年03月19日 08:54:26   作者:向陽(yáng)的野草  
這篇文章主要為大家詳細(xì)介紹了python3使用matplotlib繪制散點(diǎn)圖,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了python3使用matplotlib繪制散點(diǎn)圖,并標(biāo)注圖例,軸,供大家參考,具體內(nèi)容如下

代碼

from matplotlib import pyplot as plt
from matplotlib import font_manager

# 使得中文可以顯示出來(lái)
my_font = font_manager.FontProperties(fname="/usr/share/fonts/truetype/arphic/ukai.ttc")
y_3 = [11, 15, 17, 16, 11, 12, 11, 12, 6, 6, 7, 8, 9, 12, 15, 14, 17, 18, 21, 16, 17, 20, 14, 15, 15, 19, 21, 22, 22,
 22, 23]
y_10 = [26, 26, 28, 19, 21, 17, 16, 19, 18, 20, 20, 19, 22, 23, 17, 20, 21, 20, 22, 15, 11, 15, 5, 13, 17, 10, 11, 13,
 12,
 13, 6]
x = range(0, 31)
# print(len(y_3))
plt.figure(figsize=(20, 8), dpi=80)
# 使用scatter繪制散點(diǎn)圖和繪制折線圖的唯一區(qū)別
# x,y兩個(gè)字段的個(gè)數(shù)應(yīng)該要能夠?qū)?yīng)得上
plt.scatter(x, y_3,label="3月份")
x_2 = range(38, 69)
# lable字段可以為圖表添加圖例
plt.scatter(x_2, y_10,label="10月份")

# 調(diào)整x軸刻度
_x = list(x) + list(x_2)
_xtick_labels = ["3月{}日".format(i) for i in x]
_xtick_labels += ["10月{}日".format(i - 37) for i in x_2]
plt.xticks(_x[::3], _xtick_labels[::3], fontproperties=my_font, rotation=45)

# 添加坐標(biāo)軸描述信息
plt.xlabel("時(shí)間", fontproperties=my_font)
plt.ylabel("溫度", fontproperties=my_font)
# 設(shè)置圖表title
plt.title("三月份與十月份溫度對(duì)比", fontproperties=my_font)
# 添加圖例
plt.legend(loc="upper left",prop=my_font)
plt.show()

效果圖:

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論

宜良县| 静宁县| 长乐市| 汽车| 济宁市| 河津市| 宁都县| 绵竹市| 阿图什市| 襄樊市| 定安县| 内黄县| 平顶山市| 民勤县| 专栏| 江川县| 威信县| 通山县| 辽宁省| 新巴尔虎左旗| 衡水市| 沙湾县| 敦煌市| 内丘县| 通海县| 平乡县| 景德镇市| 东明县| 重庆市| 玉门市| 鄯善县| 科技| 观塘区| 南皮县| 德令哈市| 元朗区| 柳州市| 贵州省| 融水| 崇文区| 沂源县|