Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. import pylab as plt
  2. import numpy as np
  3. from matplotlib.ticker import LogLocator
  4.  
  5. plt.rc('text', usetex=True)
  6. f,ax=plt.subplots(figsize=(10,8))
  7. plt.xscale('log')
  8. plt.yscale('log')
  9. plt.ylim([1e26,1e29])
  10. plt.xlim([20,1e10])
  11. plt.xlabel(r'x',fontsize=22)
  12. plt.ylabel(r'y',fontsize=22)
  13. plt.tick_params(axis='both', which='major', labelsize=22,length=9,direction='in')
  14. plt.tick_params(axis='both', which='minor', labelsize=22,length=5,direction='in')
  15. ax.yaxis.set_tick_params(right='on',which='both')
  16. ax.xaxis.set_tick_params(top='on',which='both')
  17.  
  18. # manipulate x-axis ticks and labels
  19. ax.xaxis.set_major_locator(LogLocator(numticks=15)) #(1)
  20. ax.xaxis.set_minor_locator(LogLocator(numticks=15,subs=np.arange(2,10))) #(2)
  21. for label in ax.xaxis.get_ticklabels()[::2]:
  22. label.set_visible(False) #(3)
  23.  
  24. plt.savefig('example.pdf',bbox_inches='tight')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement