Add generic heatplot method
@jamesramsden-bh ci sta già lavorando.
Dal 28/3/2023.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
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
- Lingua principale
- Python
- Stelle
- 5
- Fork
- 1
- Merge medio
- 1g 10h
- PR unite (30g)
- 4
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di BHoM/Python_Toolkit
-
Add python version 3.13 Apertatype:feature
BHoM/Python_Toolkit#250 · 1 assegnatario ·
-
Searchable list box Apertatype:feature
BHoM/Python_Toolkit#243 · 1 assegnatario ·
-
type:feature
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
BHoM/Python_Toolkit#234 ·
-
type:feature
BHoM/Python_Toolkit#228 · 1 assegnatario ·
-
Colormap builder Apertatype:feature
BHoM/Python_Toolkit#217 · 1 assegnatario ·
Tutte le issue di BHoM/Python_Toolkit
Issue simili
-
essnmx good first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
-
[Feature] 奇物选择添加优先级 Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
syfoud/Simulated_Scepter#174 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Giskard-AI/giskard-oss#2840 · 1 commento ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success Apertaarea: repo bug perceived difficulty: 2
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
yeti-platform/yeti#1380 ·