Advertisement
Guest User

Untitled

a guest
Feb 27th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. import numpy as np
  2. import matplotlib as mpl
  3. import matplotlib.pyplot as plt
  4. import matplotlib.ticker as tck
  5.  
  6. chains = np.array([[-.4, 4, 0, 0, 0], [6, 19, 2000, 2.1e16, 6.1e13]])
  7. pars = np.array([r'$SF_infty$', r'$tau_D$', r'$tau$', 'width', 'scale'])
  8. nplots = len(chains[0,:]) - 1
  9.  
  10. # Fix up matplotlib to give plots like you like
  11. mpl.rcParams.update({'font.size': 6, 'font.family': 'serif', 'mathtext.fontset': 'cm', 'mathtext.rm': 'serif',
  12. 'lines.linewidth': .7, 'xtick.top': True, 'ytick.right': True})
  13.  
  14. # Make a plot
  15. fig = plt.figure()
  16. for i in range(1,nplots+1):
  17. for j in range(nplots):
  18. if (j<i):
  19. ax = plt.subplot(nplots, nplots, (i-1)*nplots+j+1)
  20. plt.plot(chains[ :, j ], chains[ :, i ], '.-', markersize=0.3, alpha=0.5)
  21.  
  22. # Set aspect
  23. xlim, ylim = ax.get_xlim(), ax.get_ylim()
  24. ax.axis([xlim[0], xlim[1], ylim[0], ylim[1]])
  25. ax.set_aspect( float(xlim[1]-xlim[0]) / (ylim[1]-ylim[0]) )
  26.  
  27. # Print things around the edges
  28. if (j == 0): plt.ylabel(pars[i])
  29. if (i == nplots): plt.xlabel(pars[j])
  30. if (j != 0): ax.tick_params(labelleft=False)
  31. if (i != nplots): ax.tick_params(labelbottom=False)
  32. if (j != i-1):
  33. ax.get_xaxis().get_offset_text().set_visible(False)
  34. ax.get_yaxis().get_offset_text().set_visible(False)
  35. # End if-statements
  36.  
  37. # Fix tickers
  38. ax.minorticks_on()
  39. ax.tick_params(which='both', direction='inout', width=0.5)
  40. ax.xaxis.set_major_locator(tck.MaxNLocator(nbins=5, prune='both'))
  41. ax.yaxis.set_major_locator(tck.MaxNLocator(nbins=5, prune='both'))
  42.  
  43. # Saving file
  44. plt.subplots_adjust(hspace=0, wspace=-.58)
  45. plt.savefig('testing.png', dpi=400, bbox_inches='tight')
  46. plt.close('all')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement