i have been trying to simulate a flow distribution in a space but couldn't figure out how to properly do it in python using matplotlib,seaborn,plotly etc.
I have 3 variables
X : 0 to 0.4 ( meshed to 142 pieces )
Y : 0 to 0.45 ( meshed to 17767 pieces )
T : Values starting from 300 Kelvin and distrubited along the room ( 142x17767 )
To explain more, I have a rectangular area which is 142x17767 and i want to plot heat distrubition on every point. I have tried seaborn's heatmap and hist2d from matplotlib but these methods require x and y dimension to have same length.
What you need is I think pcolormesh
. Here is a sample answer. You can replace T
below by your actual T-values. The reason you get the error is because on such a 2d heat map, you need to create a meshgrid of your x and y points.
import numpy as np
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(6,6))
X = np.linspace(0, 0.4, 142)
Y = np.linspace(0, 0.45, 17767)
Xmesh, Ymesh = np.meshgrid(X,Y)
T = np.random.randint(300, 1000, Xmesh.shape)
plt.pcolormesh(X, Y, T)
plt.colorbar()
plt.show()