Updated make_img.py to create both plots in a single figure test-davis-2013-10-gmu
authorAzalee Bostroem <bostroem@stsci.edu>
Fri, 26 Oct 2012 14:28:27 +0000 (10:28 -0400)
committerW. Trevor King <wking@tremily.us>
Sat, 9 Nov 2013 17:19:37 +0000 (09:19 -0800)
4-SoftwareEngineering/make_img.py

index 6eda5d703a27eab8d36b343f8915e62bb18abeda..eb4e66dba8fa22ef3b6a317920fa41b3cac9845a 100644 (file)
@@ -1,25 +1,24 @@
 import numpy as np
 import pylab
+import pdb
+
 
 #read in the image
 img = np.genfromtxt('spec_example.dat')
+ax_img = pylab.axes([0.1, 0.1, 0.65, 0.8]) #[left, bottom, width, height]
+ax_plot = pylab.axes([0.77, 0.1, 0.13, 0.8])
+
+
+
+
 #Display the image
-pylab.imshow(img, origin = 'lower', interpolation = 'nearest')
-pylab.xlim(0, 150)
+ax_img.imshow(img, origin = 'lower', interpolation = 'nearest')
 
 #Collapse the spectrum along x axis
 img_collapse = np.sum(img, axis = 1)
 #create and array to plot against
-y = np.arange(np.shape(img_collapse)[0])
-
-#Make a different figure
-#pylab.figure()
-#pylab.plot(img_collapse, y)
+y = np.arange(img_collapse.shape[0])
 
-#--------OR---------
-#Plot on the same figure
-#Create a twin y  axis
-pylab.twiny()
 #Plot to new axis
-pylab.plot(img_collapse, y, 'k', lw = 2)
-pylab.xlim(0, 60000)
+ax_plot.plot(img_collapse, y, 'k', lw = 2)
+ax_plot.set_ylim(ax_img.get_ylim())