python折线图

#! /bin/env

import matplotlib.pyplot as plt
import numpy as np

x, y = np.loadtxt("energy.txt", delimiter=" ", unpack = True)

plt.title('Figure', fontsize=20)
plt.xlabel('Group number', fontsize=12)
plt.ylabel('Energy (eV)', fontsize=12)
for a, b in zip(x, y):  
    plt.text(a, b, (a,round(b, 2)),ha='center', va='bottom', fontsize=10) 

my_x_ticks = np.arange(-0.95, 1.10, 0.01)
#my_y_ticks = np.arange(-, 2, 0.01)

plt.xticks(my_x_ticks)
#plt.yticks(my_y_ticks)

plt.plot(x, y, marker="o")
plt.show()

你可能感兴趣的:(python折线图)