froleyks

temp.py

Jan 12th, 2021
666
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3. import matplotlib.ticker as ticker
  4.  
  5. x = [0,5,9,10,15]
  6. y = [0,1,2,3,4]
  7. fig, ax = plt.subplots()
  8. ax.plot(x,y)
  9. start, end = ax.get_xlim()
  10. mimiDist = 5
  11. ax.xaxis.set_ticks(np.arange(start, end, mimiDist))
  12. ax.xaxis.set_major_formatter(ticker.FormatStrFormatter('%0.1f'))
  13. plt.show()
  14.  
RAW Paste Data