#ipython -pylab # This example uses a more interactive approach to plotting, with the pylab # environment. This seems to work # well for simple plots, and is good for developing plots "on the fly". # It also includes limits and error bars. import numpy import math import matplotlib.pyplot as plt # Note that some things like arrows are in library patches (google is your # friend here, though the matplotlib documentation is OK for most things). # Also this is an ever-changing situation. For some reason the casapy # environment does not seem to know about this patch library, so you need # to download your own version of matplotlib. from matplotlib.patches import FancyArrowPatch fig = plt.figure(figsize=(8,8)) data1 = numpy.loadtxt('ml_bhmass.txt') data2 = numpy.loadtxt('sarria.txt') data3 = numpy.loadtxt('local.txt') data4 = numpy.loadtxt('smgs.txt') data5 = numpy.loadtxt('rgs.txt') ax1 = fig.add_subplot(111,autoscale_on=False,xlim=(10,13),ylim = (7,10.5)) ax1.set_xlabel('log(Stellar mass [solar masses])') ax1.set_ylabel('log(Black hole mass [solar masses])') mstq = data1[:,0] mbhq = data1[:,1] errmstq = data1[:,2] errmbhq = data1[:,3] msts = data2[:,0] mbhs = data2[:,1] lmst = data3[:,0] lmbh = data3[:,1] mstsmg = data4[:,0] mbhsmg = data4[:,1] mstrgs = data5[:,0] mbhrgs = data5[:,1] zcosmbh = lmbh+0.4 decmbh = lmbh+0.85 ax1.add_patch(FancyArrowPatch((mstq[0],mbhq[0]),(mstq[0],(mbhq[0]+0.2) ),arrowstyle='->',mutation_scale=20,edgecolor='b')) ax1.add_patch(FancyArrowPatch((mstq[1],mbhq[1]),(mstq[1],(mbhq[1]+0.2) ),arrowstyle='->',mutation_scale=20,edgecolor='b')) ax1.add_patch(FancyArrowPatch((mstq[2],mbhq[2]),(mstq[2],(mbhq[2]+0.2) ),arrowstyle='->',mutation_scale=20,edgecolor='b')) ax1.add_patch(FancyArrowPatch((mstq[3],mbhq[3]),(mstq[3],(mbhq[3]+0.2) ),arrowstyle='->',mutation_scale=20,edgecolor='b')) ax1.add_patch(FancyArrowPatch((mstrgs[0],mbhrgs[0]),((mstrgs[0]-0.2),mbhrgs[0]),arrowstyle='->',mutation_scale=20,edgecolor='r')) ax1.add_patch(FancyArrowPatch((mstrgs[1],mbhrgs[1]),((mstrgs[1]-0.2),mbhrgs[1]),arrowstyle='->',mutation_scale=20,edgecolor='r')) ax1.add_patch(FancyArrowPatch((mstrgs[2],mbhrgs[2]),((mstrgs[2]-0.2),mbhrgs[2]),arrowstyle='->',mutation_scale=20,edgecolor='r')) plot(mstq,mbhq,'bo',markersize=10,label='Type-2 QSOs') plot(msts,mbhs,'ro',markersize=10,label='Sarria et al. obscured QSOs') plot(mstsmg,mbhsmg,'bx',markersize=10,label='SMG AGN') plot(lmst,lmbh,'k--') plot(lmst,zcosmbh,'b-.') plot(lmst,decmbh,'b-.') plot(mstrgs,mbhrgs,'rx',markersize=10,label='Radio galaxies') errorbar(mstq,mbhq,xerr=errmstq,yerr=errmbhq,fmt=None) legend(loc=2,numpoints=1) savefig('test.eps',dpi=72,facecolor='w',edgecolor='w',orientation='portrait',transparent=False,format='eps')