Add generic heatplot method
@jamesramsden-bh がすでに取り組んでいます。
2023年3月28日 から。
評価
この issue はまだ評価されていません。
説明
Implement the ability to generate plots like this below into the Python Toolkit, in a manner that can be inherited from and extended by other Python_TK-interiting toolkits.

Features to include:
- Ability to pass lists of X, Y, Z values
- Ability to enable contours and contour density
- Colormap
- Title
- Axis labels
- Enable or disable legend, and set title
- Apply formats to contour and legend values
The code below was used to generate the plot above:
import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import griddata
import matplotlib.ticker as ticker
def myfmt(x, pos):
return '{0:.1f}'.format(x)
def pcfmt(x, pos):
return '{0:.0f}%'.format(x)
# Convert from pandas dataframes to numpy arrays
X0, Y0, Z0, = np.array([]), np.array([]), np.array([])
for i in range(len(X_dat)):
X0 = np.append(X0, X[i])
Y0 = np.append(Y0, Y[i])
Z0 = np.append(Z0, Z[i])
# create x-y points to be used in heatmap
xi = np.linspace(X0.min(), X0.max(), 1000)
yi = np.linspace(Y0.min(), Y0.max(), 1000)
# Interpolate for plotting
zi = griddata((X0, Y0), Z0, (xi[None,:], yi[:,None]), method='cubic')
# Create the contour plot
CS = plt.contourf(xi, yi, zi, 150, cmap="Oranges_r",
vmax=zi.max(), vmin=zi.min())
intervals = int(zi.max() - zi.min())
CS2 = plt.contour(xi, yi, zi, intervals, colors='k')
plt.clabel(CS2, inline=1, fontsize=10, colors='k', fmt=ticker.FuncFormatter(pcfmt))
plt.colorbar(CS, label="% hours comfortable", format=ticker.FuncFormatter(myfmt))
plt.xlabel("Evaporative cooling ratio")
plt.ylabel("Wind porosity ratio")
plt.title("% annual hours with UTCI between 9°C and 32°C")
plt.show()
cc @tg359
- 主要言語
- Python
- スター
- 5
- フォーク
- 1
- 平均マージ
- 1日 10時間
- マージ済み PR(30日)
- 4
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
BHoM/Python_Toolkit のほかの issue
-
type:feature
BHoM/Python_Toolkit#250 · 担当者 1 名 ·
-
Searchable list box オープンtype:feature
BHoM/Python_Toolkit#243 · 担当者 1 名 ·
-
type:feature
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
BHoM/Python_Toolkit#234 ·
-
type:feature
BHoM/Python_Toolkit#228 · 担当者 1 名 ·
-
Colormap builder オープンtype:feature
BHoM/Python_Toolkit#217 · 担当者 1 名 ·
BHoM/Python_Toolkit の issue をすべて見る
似ている issue
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
canonical/paas-charm#368 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
tech debt
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
StevenBlack/hosts#3256 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
qualcomm/qai-appbuilder#275 ·