I'm parsing a log file and creating a plot.
I don't need all labels on X axis. I want to display only a first one and a last one or a few of them with particular step let's say every 100.
How I can do this? I can display only first one or only last one but not both together.
My code:
import numpy as np
import pylab as pl
import matplotlib.pyplot as plt
with open('file.log') as f:
lines = f.readlines()
x = [int(line.split(',')[0]) for line in lines]
my_xticks = [line.split(',')[1] for line in lines]
y = [int(line.split(',')[2]) for line in lines]
z = [int(line.split(',')[3]) for line in lines]
plt.xticks(x, my_xticks[0], visible=True, rotation="horizontal")
plt.xticks(x, my_xticks[-1], visible=True, rotation="horizontal")
plt.plot (x,z)
plt.plot (x,z)
plt.plot(x, y)
plt.show()
Thank you!