Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import matplotlib as mpl
- import matplotlib.pyplot as plt
- import matplotlib.ticker as tck
- chains = np.array([[-.4, 4, 0, 0, 0], [6, 19, 2000, 2.1e16, 6.1e13]])
- pars = np.array([r'$SF_infty$', r'$tau_D$', r'$tau$', 'width', 'scale'])
- nplots = len(chains[0,:]) - 1
- # Fix up matplotlib to give plots like you like
- mpl.rcParams.update({'font.size': 6, 'font.family': 'serif', 'mathtext.fontset': 'cm', 'mathtext.rm': 'serif',
- 'lines.linewidth': .7, 'xtick.top': True, 'ytick.right': True})
- # Make a plot
- fig = plt.figure()
- for i in range(1,nplots+1):
- for j in range(nplots):
- if (j<i):
- ax = plt.subplot(nplots, nplots, (i-1)*nplots+j+1)
- plt.plot(chains[ :, j ], chains[ :, i ], '.-', markersize=0.3, alpha=0.5)
- # Set aspect
- xlim, ylim = ax.get_xlim(), ax.get_ylim()
- ax.axis([xlim[0], xlim[1], ylim[0], ylim[1]])
- ax.set_aspect( float(xlim[1]-xlim[0]) / (ylim[1]-ylim[0]) )
- # Print things around the edges
- if (j == 0): plt.ylabel(pars[i])
- if (i == nplots): plt.xlabel(pars[j])
- if (j != 0): ax.tick_params(labelleft=False)
- if (i != nplots): ax.tick_params(labelbottom=False)
- if (j != i-1):
- ax.get_xaxis().get_offset_text().set_visible(False)
- ax.get_yaxis().get_offset_text().set_visible(False)
- # End if-statements
- # Fix tickers
- ax.minorticks_on()
- ax.tick_params(which='both', direction='inout', width=0.5)
- ax.xaxis.set_major_locator(tck.MaxNLocator(nbins=5, prune='both'))
- ax.yaxis.set_major_locator(tck.MaxNLocator(nbins=5, prune='both'))
- # Saving file
- plt.subplots_adjust(hspace=0, wspace=-.58)
- plt.savefig('testing.png', dpi=400, bbox_inches='tight')
- plt.close('all')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement