I have a set of data:
x = np.array([1,1,1,2,2,2,3,3,3,4])
y = np.array([1,2,3,1,2,3,1,2,3,1])
z = np.array([0.1,0.9,0.75,0.8,1,1.2,0.6,0.3,0.1,9])
Where you can see x values repeat and y values as well. Now, I would like to make a plot, so that for each coordinate of x and y I have a correspondent value z.
I have tried the following:
fig, ax = plt.subplots()
x = np.unique(x) # Get only non-repeated values from x
y = np.unique(y)
X, Y = np.meshgrid(x, y)
a = df.index.values # This data is just and examplification, I actually have the data as dataframe
if a.all() % 2 != 0: # Just a condition to make a 2d array
cu = np.reshape(z,(-1,2))
dose = (cu / 1e-9) * 3.38E-3
scat = ax.scatter(X, Y, c=dose, s=abs(x[0] - x[1]), marker='s', cmap='jet')
ax.margins(0.05)
plt.show()
This code gives me an error, saying the shape of the arrays are mismatching. How to fix it?
Here is an example of aimage I would like to plot.