Advertisement
KristinHoch

Week 4 Multiplot Script

Jul 6th, 2018
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. import yt
  2. import matplotlib.pyplot as plt
  3. from mpl_toolkits.axes_grid1 import AxesGrid
  4. import sys
  5.  
  6. fig = plt.figure()
  7. grid = AxesGrid(fig, (0.08, 0.075, 0.85, 0.28), nrows_ncols = (1, 3), axes_pad = 0.05, label_mode = "L", share_all = True, cbar_location = "right", cbar_mode = "single", cbar_size = "3%", cbar_pad = "0%")
  8.  
  9. for i in range(1,len(sys.argv)):
  10. ds = yt.load(sys.argv[i])
  11. p = yt.SlicePlot(ds, 'z', "Temperature", width = (3.5, 'kpc'), fontsize = 12)
  12. p.set_zlim("Temperature", 1e1, 4e5)
  13. p.set_cmap(field="Temperature", cmap = "hot")
  14. p.annotate_title('z = %.2f'%ds.current_redshift)
  15. plot = p.plots["Temperature"]
  16. plot.figure = fig
  17. plot.axes = grid[i-1].axes
  18. plot.cax = grid.cbar_axes[i-1]
  19.  
  20. p._setup_plots()
  21. plt.savefig("multiplot.png")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement