While making this contour plot, I'm always not able to plot either the first row and first column or the last row and the last column. The .dat file has a 44 X 54 matrix of float values whose Contour plot I'm trying to make.
Every time I try to take my x1 list of 56 size in order to populate my plot with all the values from my .dat file, it says the size of x1 should be equal to the number of columns in z.
In this image you can see the first row and column is being omitted
In this image you can see the last row and column is being omitted
import numpy as np
import matplotlib.pyplot as plt
def contour_plot(filename):
#Reading the porosity data from the dat file
#data = (np.loadtxt(filename))
data = np.random.random((44,54))
#Making two empty lists to account for the size of each grid block
x1=[]
for i in range(1,55):
x1.append(i*130.75)
x2=[]
for j in range(1,45):
x2.append(j*130.75)
#Using pyplot.contourf() to make contours using the porosity values and pyplot.colorbar() to show the chart for correlation
plt.contourf(x1, x2, data[::-1])
plt.colorbar()
plt.title("Porosity")
plt.savefig('Porosity.png',bbox_inches='tight')
contour_plot("Nechelik.dat")
I want all the 44 rows and 54 columns to be plotted in the Contour plot however that is not happening.