# -*- coding: utf-8 -*-
"""
Created on Fri Nov 10 21:20:25 2017
@author: zhoulei
"""
# Required Packages
# 回归
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from sklearn import datasets, linear_model
# 热力图
import matplotlib.cm as cm
from matplotlib.colors import LogNorm
# Function to get data
def get_data(file_name,hour):
data = pd.read_csv(file_name)
X_parameter = []
Y_parameter = []
Z_parameter = []
coln = 'wind_'+ str(hour)
for x ,y,z in zip(data['x'],data['y'],data[coln]):
X_parameter.append(int(x))
Y_parameter.append(int(y))
Z_parameter.append(float(z))
return X_parameter,Y_parameter,Z_parameter
# Function to show Thermodynamic diagram
def draw_thermodynamic_diagram(fileName,hour):
print(fileName,hour)
x,y,z = get_data(fileName,hour)
x_min = np.min(x)
x_max = np.max(x)
y_min = np.min(y)
y_ma
【python/热力图】从csv文件读入(x,y,z)画简单热力图
最新推荐文章于 2024-09-22 16:58:21 发布
使用Python从CSV文件中读取(x, y, z)数据,详细讲解如何生成简洁明了的热力图。文章包含具体实现步骤及最终4色效果展示。"
119520947,10446075,C++输出格式控制:精度与进制设定,"['C++编程', '输出格式', '编程基础']
摘要由CSDN通过智能技术生成