I want to plot my graph with a scientific number in y-axis. I have used ticklabel format from matplotlib. But I am not getting my desire output in y-axis label. I have attached my script with output image (image_1) and image_2 is my desire one.
Code:
import numpy as np
import matplotlib.pyplot as plt
x1, y1 = [], []
label_added =False
with open("50kev_vacancy.txt") as f:
for line in f:
cols = line.split()
x1.append(float(cols[0]))
y1.append(float(cols[3]))
if not label_added:
plt.plot(x1,y1,'b-', label="50kev")
label_added = True
else:
plt.plot(x1,y1,'b-')
plt.title('Different PKA energy')
plt.xlabel('time_ps')
plt.ylabel('Number of vacancy')
plt.ticklabel_format(style='sci', axis='y', scilimits=(0,0))
legend = plt.legend(loc='upper center', shadow=True, fontsize='x-large')
plt.tight_layout()
plt.savefig("Different_PKA_energy_vacancy_vs_time.jpeg", dpi=50)
desired output: