Add generic heatplot method
@jamesramsden-bh arbeitet bereits daran.
Seit 28.3.2023.
Bewertung
Dieses Issue wurde noch nicht bewertet.
Beschreibung
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
- Vorherrschende Sprache
- Python
- Sterne
- 5
- Forks
- 1
- Ø Merge
- 3 T. 23 Std.
- Gemergte PRs (30 T.)
- 3
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus BHoM/Python_Toolkit
-
Use UV for environment managementEvtl. vergeben @Felix-Mallinder hat das vor 4 Tagen übernommen. Offentype:feature
BHoM/Python_Toolkit#253 · 1 zugewiesene Person ·
-
Add python version 3.13Evtl. vergeben @Tom-Kingstone hat das vor 19 Tagen übernommen. Offentype:feature
BHoM/Python_Toolkit#250 · 1 zugewiesene Person ·
-
Searchable list boxEvtl. wieder frei @Felix-Mallinder hat das vor 46 Tagen übernommen, und es ist kein Pull Request offen. Offentype:feature
BHoM/Python_Toolkit#243 · 1 zugewiesene Person ·
-
type:feature
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
BHoM/Python_Toolkit#234 ·
-
capture toolkit name properly in python logsEvtl. wieder frei @Tom-Kingstone hat das vor 76 Tagen übernommen, und es ist kein Pull Request offen. Offentype:feature
BHoM/Python_Toolkit#228 · 1 zugewiesene Person ·
Alle Issues in BHoM/Python_Toolkit
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
Maintainer antworten meist innerhalb von 1 Tag
-
area:docs
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
RailtownAI/railtracks#1633 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
review-panel severity:low
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 85/100
kristovatlas/coin-accounting#152 ·
Maintainer antworten meist innerhalb von 1 Tag
-
documentation :blue_book:
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
PennyLaneAI/pennylane#10280 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
`pipx reinstall` prints a Python traceback when the reinstall failsEvtl. vergeben @ParamTanna hat das heute übernommen. Offenbug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag