I am trying to plot using the attached file data file, "wan_band.dat". In the past, I also found the same error. But somehow it was resolved automatically. Again, I stuck with it. I am not able to understand the reason for the issue. The error is mentioned in the attached image, "Reshape-error.PNG".

I am using the Python code to plot using the commands as,

import matplotlib.pyplot as plt

from matplotlib import rcParamsDefault

import numpy as np

%matplotlib inline

import os # To load image/data from path. #### ##################################################################################################

plt.rcParams["figure.dpi"]=150

plt.rcParams["figure.facecolor"]="white"

plt.rcParams["figure.figsize"]=(8, 6) ################################################################################################## ##################################################################################################

data = np.loadtxt("../wannier90/wan_band.dat")

k = np.unique(data[:, 0])

bands = np.reshape(data[:, 1], (-1, len(k)))

for band in range(len(bands)):

plt.plot(k, bands[band, :], "o-", markersize=5, linewidth=2, alpha=0.8, color='b', linestyle='-')

plt.xlim(min(k), max(k))

plt.xlim(0, 3.81842), plt.ylim(-8, 8)

##################################################################################################

plt.rc('ytick',labelsize=20),

plt.rc('xtick',labelsize=20),

plt.show() ##################################################################################################

I have a guess that the error has occurred cause of "bands = np.reshape(data[:, 1], (-1, len(k)))", but not able to understand.

Please help me about the same.

More Sharad Kumar Upadhyay's questions See All
Similar questions and discussions