使用python绘制温度变化雷达图

yipeiwu_com5年前Python基础

本文实例为大家分享了python绘制温度变化雷达图的具体代码,供大家参考,具体内容如下

假设某天某地每三个小时取样的气温为

针对温度变化趋势绘制雷达图:

代码如下:

import numpy as np
import matplotlib.pyplot as plt
#标签
labels = np.array(['3℃','5℃','6℃','3℃','1℃','3℃','3℃','2℃'])
#数据个数
dataLenth = 8
#数据
data = np.array([3,5,6,3,1,3,3,2])


angles = np.linspace(0, 2*np.pi, dataLenth, endpoint=False)
data = np.concatenate((data, [data[0]])) 
angles = np.concatenate((angles, [angles[0]])) 
 
fig = plt.figure()
ax = fig.add_subplot(111, polar=True)
ax.plot(angles, data, 'ro-', linewidth=2)
ax.set_thetagrids(angles * 180/np.pi, labels, fontproperties="SimHei")
ax.set_title("温度变化雷达图", va='bottom', fontproperties="SimHei")
ax.grid(True)
plt.show()

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持【听图阁-专注于Python设计】。

相关文章

python实现的生成word文档功能示例

python实现的生成word文档功能示例

本文实例讲述了python实现的生成word文档功能。分享给大家供大家参考,具体如下: 每月1次的测试费用报销,需要做一个文档。干脆花点时间写个程序吧。 # -*- coding:...

Python3正则匹配re.split,re.finditer及re.findall函数用法详解

本文实例讲述了Python3正则匹配re.split,re.finditer及re.findall函数用法。分享给大家供大家参考,具体如下: re.split re.finditer r...

pycharm 配置远程解释器的方法

pycharm 配置远程解释器的方法

1、Pycharm -> References(进入设置界面): 2、点击 Project Interpreter: 3、点击 Add Remote 来添加远程解释器:...

python加载自定义词典实例

如下所示: #加载词典 def load_dict_from_file(filepath): _dict = {} try: with io.open(filepat...

对Python 窗体(tkinter)树状数据(Treeview)详解

如下所示: import tkinter from tkinter import ttk #导入内部包 win=tkinter.Tk() tree=ttk.Treeview(wi...