I have individual x arrays for each intensity (Z) array. Which means that the intensity rows will not be stacked on top of each other. I do not want the tiles to “tilt” so they are connected to the row above and below, I just want them to be straight in the y direction and connected in the x direction. Thank you very much in advance!
Here is a dummy code:
import numpy as np
import matplotlib.pyplot as plt
y_values = np.array([0, 1, 2, 3, 4, 5], dtype=float)
x_list = range(50, 70)
x_values_list = []
z_values_list = []
for i in range(len(y_values)):
x_value_single_list = [np.array(0.01*x**2 + 0.1*x*i + 0.3 * i, dtype= float) for x in x_list]
x_values_list.append( x_value_single_list)
z_values_list.append(np.random.rand(20))
z_values_list = [np.array(arr, dtype=float) for arr in z_values_list]
x_values_list = [np.array(arr, dtype=float) for arr in x_values_list]
fig, ax = plt.subplots()
c = ax.pcolormesh(x_values_list, y_values, z_values_list, cmap='viridis') #, shading='auto'
plt.colorbar(c)
plt.show()
Image with tilted tiles
I have tried a bunch of kwargs but a lot of them does not seem to do anything and seem to not be implemented for pcolormesh and more suited for regular line plots. I have obviously tried a lot with ChatGPT.
introlol is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.