I want the x-axis labels to be exactly as in the file, but it’s converting them. Also, I don’t want the thick black line above the labels. And, I’d like the plot to extend fully to both sides of the area without the empty spaces on the left and right.
plot:
python script:
#!/usr/bin/python3
import matplotlib.pyplot as plt
import numpy as np
a,b = np.genfromtxt("test01.txt", usecols=(0,1), unpack=True, delimiter="t", dtype='str')
y = list(map(float, b))
plt.figure(figsize=(9, 5))
plt.plot(a, y, linewidth=0.7)
xticks = plt.xticks()[0]
xtick_labels = ["" if i % 100 != 0 else x for i, x in enumerate(xticks)]
plt.xticks(xticks, xtick_labels, fontsize=8)
plt.xticks(rotation=90)
plt.yticks(np.arange(100, 185, 5))
plt.ylim(110, 185)
plt.xlabel("Time")
plt.ylabel("Temp in F")
plt.show()
sample data from the file:
00:00:02 170.9
00:00:03 171.7
00:00:04 171.9
00:00:04 171.8
00:00:05 171.4
00:00:06 170.9
00:00:07 170.1
00:00:08 169.4
00:00:09 168.5
00:00:10 167.6