In [5]:
#from yt.mods import *
import yt
import numpy as np
import math
import pylab as P 
import os

import matplotlib.pyplot as plt

from yt import derived_field
from yt.data_objects.particle_filters import add_particle_filter
from yt.units import meter, gram, second, kilogram,  joule, cm, parsec, Kelvin, Megayear, kilometer, pc, kpc, km, erg

%matplotlib inline

# Define some constant parameters to be used.
kpc = 3.0856e21  # cm
pc  = 3.0856e18  # cm

km  = 1.0e5      # cm
Myr = 3.1556e13  # s

mp      = 1.6726e-24  * gram # g
mu      = 1.2924
kb      = 1.3806e-16  *erg / Kelvin # erg K-1
GNewton = 6.6743e-8   * cm**3 / (gram * second**2 )# cm3 g-1 s-2
Msun    = 1.9884e33   * gram 
mm      = mu*mp

machine = os.uname()[1]
In [6]:
# Create a derived field.
@derived_field(name="numdens", units="1/cm**3", force_override=True)
def numdens(field, data):
    #mp      = 1.6726e-24 * gram
    #mu      = 1.2924
    #mm      = mu*mp
    dens_here = data["dens"].value
    dens_here = dens_here * gram / cm**3
    return dens_here/mm

yt.add_field('numdens', function=numdens, units="1/cm**3", force_override=True )
/home/jcibanezm/codes/libs/yt3.4/yt-conda/lib/python3.6/site-packages/yt/fields/local_fields.py:46: UserWarning: Because 'sampling_type' not specified, yt will assume a cell 'sampling_type'
  warnings.warn("Because 'sampling_type' not specified, yt will "
In [7]:
Mdot_NOSG_1pc = np.array([ -4.70264939e-04,  -3.89726645e-04,   7.09425055e-04,  -9.48287000e-08,
  -9.08637643e-04,   5.54723464e-04,  -2.25586908e-04,  -9.48524267e-03,
  -1.28802915e-04,   5.50874230e-04,  -1.92963617e-03,  -4.83499621e-04,
  -1.21230307e-04,  -6.75766502e-05,  -1.89966174e-04,   1.52884662e-04,
  -2.25777195e-04,  -1.41033604e-04,  -5.08340668e-04,  -2.38762810e-04,
   2.33206885e-04,  -1.30606267e-03,  -2.63653191e-04,  -2.49140566e-04,
  -4.62809471e-04,  -9.19087449e-05,  -1.02954536e-04,  -3.48719543e-04,
  -6.58258280e-05,   2.75030270e-04,  -1.00540096e-03,   2.25697541e-05,
  -1.32956480e-04,  -8.08619428e-04,   1.07668681e-03,   1.16779231e-04,
  -7.56248873e-05,  -4.18117568e-04,  -4.87584008e-04,   6.50136000e-04,
   1.07766266e-04,  -7.83590128e-04,  -3.73902241e-03,   5.37511414e-03,
  -9.43494630e-05,   8.20228960e-05,   4.00746513e-04,  -2.07572074e-04,
  -1.97260845e-04,  -5.71068695e-05,   2.31028240e-04,  -5.46605739e-04,
   4.08862593e-06,   2.76015656e-04,  -9.12232804e-04,  -2.13262714e-04,
  -1.39651429e-04,  -3.23507953e-05,   1.72056635e-03,   3.55226004e-06,
  -6.63878780e-04,   1.13901450e-05,  -2.09143044e-04,  -6.65281328e-05,
  -1.57751995e-03,  -7.45087700e-04,  -1.78972481e-04,  -8.41406408e-05,
  -2.22935555e-04,  -8.31904953e-05,   2.71381550e-04,  -2.59702624e-04,
  -2.01510608e-04,  -2.51900742e-04,  -1.73325016e-04,   4.12537372e-04,
  -1.80092549e-04,   6.80831138e-03,  -2.28921174e-04,   2.54234250e-03,
  -6.16081204e-04,  -4.59052810e-04,   2.42303352e-04,  -1.48512533e-03,
  -6.57562563e-04,  -7.77714910e-04,  -6.58558407e-04,  -9.91102433e-05,
  -1.55178420e-04,   6.27244900e-07,  -7.51136634e-04,  -4.19723785e-04,
  -9.74800880e-04,  -3.55463456e-03,  -1.39778861e-04,  -1.89279553e-04,
   8.18444119e-04,  -7.29260326e-04,   5.19491362e-04,   4.06094278e-05,
  -3.45803984e-04,  -1.04009979e-04,   3.70085831e-03,  -8.63612856e-04,
   2.20827503e-04,  -3.82070981e-05,  -1.87092424e-03,  -2.39901902e-04,
  -1.03030390e-03,  -7.78415140e-05,   7.92762469e-05,  -1.19946368e-04,
  -3.99264135e-04,  -3.01597213e-03,  -2.57309614e-04,   3.81631762e-04,
  -8.75468961e-05,   2.79841280e-04,  -7.93081863e-05,  -2.71794321e-03,
  -5.78296618e-04,   2.39057642e-04,  -6.70444661e-05,  -2.33967146e-04,
  -4.98071709e-03,  -1.83039630e-04,  -3.17972981e-05,  -2.75987943e-05,
   6.20598143e-05,  -1.76712429e-03,  -1.56573014e-03,  -1.18455437e-04,
   2.48493311e-05,  -1.02064608e-03,   2.07372558e-03,  -2.83201907e-03,
  -7.94701441e-04,  -4.58256068e-04,  -1.21250157e-03,  -6.03056574e-04,
  -8.77380490e-04,  -2.50308858e-04,   4.65256664e-05,  -8.71572195e-04,
  -8.26313759e-05,  -3.63244395e-04,   7.63192130e-03,  -1.81601357e-04,
   3.83405881e-04,   1.40031930e-03,  -2.06902061e-03,  -3.54806558e-05,
  -5.28521524e-04,  -8.66412119e-05,  -2.55410374e-04,  -4.81264576e-04,
  -5.74843048e-05,  -1.38851016e-04,  -9.41701301e-05,   5.13176690e-03,
  -8.42471006e-04,  -1.03495935e-03,  -2.30648027e-04,   4.65997151e-05,
  -2.67517562e-04,   8.93387201e-05,  -4.18833375e-04,  -5.00566079e-04,
  -1.54676083e-05,  -4.93855397e-05,  -6.28527005e-04,  -4.07996842e-06,
  -7.73197666e-05,  -4.13633261e-04,  -2.79933431e-04,  -1.56680853e-04,
  -1.47461944e-03,  -4.02642767e-03,  -1.01976058e-03,  -1.49111845e-04,
  -8.88571535e-05,  -1.27464409e-04,  -1.00853274e-03,   9.10225840e-04,
  -8.00978035e-04,   2.97401601e-05,   1.23791307e-04,  -5.69919764e-04,
   1.65853901e-04,   5.03659991e-04,  -2.82010703e-03,  -2.71293277e-04,
  -2.28594831e-04,   2.91309612e-04,  -3.59711152e-04,  -3.91269416e-04,
  -1.51032076e-04,   3.89433746e-05,  -1.96402745e-04,  -1.89888723e-04,
  -1.39697992e-04,  -1.19368505e-04,  -2.72314318e-04,   2.69006450e-04,
  -6.54389191e-03,   6.39771859e-05,  -1.62583370e-03,  -1.63737609e-04,
  -3.14965176e-04,  -1.70509607e-04,   4.74352605e-03,  -3.74902571e-05,
  -9.18027203e-05,   2.94068292e-04,  -2.13003691e-04,  -3.49443191e-05])


M_NOSG_1pc = np.array([  2.45192117e+03,   1.46994295e+03,   5.93474579e+03,   7.61579632e+04,
   3.65683104e+04,   3.06546623e+03,   1.80294925e+03,   2.60252082e+05,
   5.28259141e+03,   1.86970707e+06,   5.86867158e+04,   1.17966511e+03,
   1.56078878e+04,   8.46210197e+02,   8.46525770e+02,   1.07608258e+04,
   6.77934125e+02,   7.12094542e+02,   7.30431684e+03,   3.12827200e+03,
   4.11827206e+03,   6.88357677e+04,   7.04001084e+02,   1.18157064e+03,
   6.54437509e+03,   2.25389427e+03,   7.31982122e+02,   1.01660972e+04,
   4.98366376e+02,   2.02364924e+03,   1.39636189e+04,   5.89578610e+02,
   1.81963429e+03,   8.27855077e+03,   1.99362706e+04,   4.56717744e+03,
   8.87479102e+02,   4.28509858e+03,   3.37785698e+03,   5.50716419e+04,
   7.89465164e+02,   1.04244375e+04,   4.73412952e+05,   1.33679647e+05,
   1.00950815e+03,   1.04158793e+03,   3.04995236e+04,   1.24952830e+03,
   3.00798838e+03,   6.37142788e+02,   3.51638497e+02,   1.43780984e+03,
   1.27320559e+03,   2.83953260e+03,   1.40585270e+04,   3.05362102e+03,
   1.01379218e+03,   6.08156562e+03,   1.09335020e+04,   5.23421655e+02,
   9.64084736e+03,   3.59631390e+03,   1.57736234e+03,   4.32540548e+02,
   1.87025794e+06,   2.89027297e+03,   6.96309936e+02,   1.27729422e+03,
   7.20465968e+02,   5.63420667e+02,   1.19281070e+03,   1.09137105e+04,
   2.84035831e+03,   7.27537375e+02,   2.35815272e+03,   1.54866575e+04,
   6.56559596e+02,   6.89291839e+05,   2.81072753e+03,   2.80264123e+04,
   2.11804173e+03,   1.98165623e+03,   7.45138504e+02,   2.83814991e+04,
   1.71816494e+04,   4.35147895e+03,   2.88950919e+03,   4.39916226e+02,
   2.03251432e+03,   5.81643278e+04,   3.09002701e+04,   8.91204106e+02,
   1.07062228e+04,   5.67570796e+04,   5.71060938e+02,   6.96165491e+02,
   5.70003870e+03,   9.81737768e+03,   5.54345214e+03,   7.59883312e+02,
   2.16198553e+03,   2.06381660e+03,   3.43011539e+04,   7.46993134e+03,
   2.10129574e+04,   4.09185169e+02,   1.29582180e+04,   1.08021630e+03,
   6.75297051e+04,   2.87922477e+03,   3.62018969e+03,   6.63057677e+02,
   3.56596727e+04,   1.81616867e+04,   7.62364051e+02,   3.11554825e+03,
   6.29027586e+02,   2.29867951e+03,   5.80035918e+02,   1.74812281e+05,
   8.97696858e+03,   7.42232241e+03,   1.06540078e+04,   1.87733590e+03,
   5.36423807e+05,   1.99280055e+03,   6.51848282e+03,   4.31282078e+02,
   1.36821930e+03,   1.10872937e+04,   2.68963738e+04,   1.46419225e+03,
   7.18734314e+02,   1.58991949e+04,   1.41963751e+05,   1.19780690e+05,
   1.50196053e+03,   2.12337849e+04,   1.65240868e+04,   6.27344077e+03,
   9.08811735e+03,   1.81618154e+03,   6.04921483e+03,   1.26960014e+04,
   5.86683936e+02,   2.87103501e+03,   6.96100151e+05,   1.21974330e+03,
   6.06294350e+03,   3.01491335e+04,   3.52604086e+04,   8.00492740e+02,
   1.52260342e+03,   2.00664286e+04,   7.32437900e+03,   3.57376404e+03,
   7.99731114e+02,   5.00727732e+02,   4.76467047e+02,   1.86868042e+06,
   6.60631848e+03,   9.73142188e+03,   4.97466449e+03,   5.61369483e+04,
   3.69946594e+03,   9.64975055e+02,   3.60770405e+03,   2.14518527e+03,
   1.93249665e+03,   4.33115109e+02,   1.48785488e+04,   7.42246809e+02,
   1.50021961e+03,   5.67038420e+03,   2.50779061e+03,   1.56587268e+03,
   2.53306436e+04,   1.22912898e+04,   2.49030005e+05,   3.09249946e+03,
   5.29226183e+02,   5.91476479e+02,   8.69646254e+03,   1.87381219e+06,
   8.21073686e+03,   4.82664919e+02,   7.22066737e+02,   3.15494528e+04,
   2.47320985e+03,   6.09574049e+03,   1.72094338e+05,   1.64336876e+03,
   4.74401646e+03,   7.17316040e+02,   3.18887068e+03,   6.43956300e+04,
   1.29680254e+03,   5.04052560e+02,   7.07259085e+02,   5.78809248e+02,
   5.63480662e+02,   1.93727213e+03,   2.07755289e+04,   2.77366215e+03,
   7.92812482e+05,   1.05431378e+03,   3.31913880e+04,   1.77419973e+03,
   2.09089948e+03,   6.72672097e+03,   4.54164067e+04,   4.99650166e+02,
   1.64461919e+03,   8.39867196e+03,   5.94933543e+03,   1.65641247e+03])

Surface_Area = np.array([6.8149589912111251e+39, 6.6089652685548695e+39, 1.546669534277386e+40, 1.1787990779004117e+41, 
                         4.0460600358401128e+40, 1.2239460354492522e+40, 5.4245013632813986e+39, 3.0753146178218183e+41, 
                         9.6130403906252624e+39, 9.3922837845096593e+41, 9.86194947216848e+40, 4.514695754882937e+39, 
                         3.1688701001954953e+40, 2.145767944335997e+39, 2.9010782607422675e+39, 2.2161491329102194e+40, 
                         3.0040751220703959e+39, 2.952576691406332e+39, 1.7887121583984863e+40, 1.1981968201172203e+40, 
                         1.1278156315429996e+40, 1.4603238321972226e+41, 5.1326769228517044e+39, 3.6220562900391621e+39, 
                         1.6960149832031713e+40, 9.424212811523696e+39, 2.5062569589844446e+39, 2.7088174529298008e+40, 
                         1.9569403652344297e+39, 1.1037830305664365e+40, 2.8718958166993524e+40, 3.5533917158204109e+39, 
                         7.0896172880861313e+39, 2.6401528787110392e+40, 2.9869089785157695e+40, 1.3492588833984744e+40, 
                         4.4116988935548086e+39, 9.424212811523696e+39, 1.1003498018554989e+40, 6.4973853354497604e+40, 
                         4.1198744531251138e+39, 2.2230155903320941e+40, 3.4557163589935856e+41, 1.8647581743455682e+41, 
                         5.4073352197267112e+39, 5.853654952148599e+39, 7.7196147565435968e+40, 4.1885390273438656e+39, 
                         9.6130403906252636e+39, 2.5920876767578841e+39, 2.6264199638672604e+39, 7.1067834316408205e+39, 
                         6.0596486748048546e+39, 9.6817049648440143e+39, 5.405618605371479e+40, 8.1882504755861624e+39, 
                         5.1326769228517038e+39, 1.6325002520508258e+40, 3.4555446975588018e+40, 2.7809152558594524e+39, 
                         2.1749503883789656e+40, 8.0509213271486587e+39, 5.5103320810548384e+39, 2.0256049394531816e+39, 
                         9.2973550106522678e+41, 1.1175159454101869e+40, 3.467560998046971e+39, 5.9738179570314135e+39, 
                         3.0555735527344598e+39, 2.0256049394531812e+39, 5.2700060712892069e+39, 2.3345955234375731e+40, 
                         7.9135921787111549e+39, 3.5705578593750982e+39, 5.3386706455079588e+39, 3.120804898242356e+40, 
                         2.5405892460938205e+39, 7.6730945075081685e+41, 9.9906955488283989e+39, 5.446817349902734e+40, 
                         8.0852536142580334e+39, 6.2313101103517342e+39, 5.2528399277345201e+39, 2.8907785746095343e+40, 
                         4.365350305957309e+40, 1.4162068432617575e+40, 1.158714689941438e+40, 2.2659309492188134e+39, 
                         6.8492912783204998e+39, 8.3496122250006118e+40, 7.9238918648444305e+40, 4.4631973242188737e+39, 
                         1.9294745355469277e+40, 1.0194972657129329e+41, 2.7637491123047644e+39, 2.5405892460938202e+39, 
                         2.2710807922852247e+40, 2.7980813994141903e+40, 2.9989252790040342e+40, 3.8452161562501063e+39, 
                         9.9220309746096458e+39, 8.308413480468977e+39, 4.8116700383792909e+40, 2.6676187083985419e+40, 
                         3.1637202571290667e+40, 2.5062569589844446e+39, 3.0109415794923322e+40, 5.1155107792970158e+39, 
                         1.5063290969237952e+41, 1.5415196912109796e+40, 1.4059071571289447e+40, 4.4803634677735611e+39, 
                         4.1902556416995106e+40, 2.0908362849609946e+40, 2.2487648056641248e+39, 1.0437015281250285e+40, 
                         2.3345955234375649e+39, 1.1381153176758124e+40, 2.5234231025391326e+39, 1.0881618399316592e+41, 
                         2.1801002314453722e+40, 2.1320350294922457e+40, 2.0187384820313051e+40, 6.8836235654298757e+39, 
                         4.7509018901944406e+41, 6.6261314121095575e+39, 2.7688989553712111e+40, 2.5062569589844446e+39, 
                         5.6819935166017181e+39, 2.8255472291016823e+40, 3.095055682910338e+40, 6.3171408281251741e+39, 
                         3.2787334189454034e+39, 3.383446894629108e+40, 2.0544440606248427e+41, 1.7243391200682834e+41, 
                         6.4201376894533019e+39, 3.0916224541993729e+40, 4.2554869872072915e+40, 1.5312200050781668e+40, 
                         2.6830682375977683e+40, 9.2697175195315043e+39, 1.7715460148437984e+40, 2.688218080664167e+40, 
                         3.0040751220703959e+39, 9.4585450986330719e+39, 7.9269817706819351e+41, 6.0424825312501666e+39, 
                         3.0143748082032557e+40, 7.6475169536139141e+40, 4.4065490504886123e+40, 3.7765515820313538e+39, 
                         5.7163258037110952e+39, 3.0590067814454706e+40, 2.4272926986328949e+40, 1.0883335013672173e+40, 
                         3.4675609980469704e+39, 2.2487648056641248e+39, 2.0942695136719331e+39, 9.4127114953397322e+41, 
                         2.5543221609375936e+40, 1.9088751632813021e+40, 9.5615419599611997e+39, 7.4192072443365733e+40, 
                         1.2720112374023786e+40, 1.7509466425781735e+39, 8.2912473369142902e+39, 9.1323883710940006e+39, 
                         7.3127771542970761e+39, 2.7980813994141403e+39, 3.3388149213869188e+40, 3.3645641367188426e+39, 
                         4.8065201953126324e+39, 1.3664250269531624e+40, 8.6345702080080495e+39, 9.441378955078384e+39, 
                         3.0332575661134618e+40, 1.8384939747070814e+40, 3.1911860868159337e+41, 9.0808899404299367e+39, 
                         2.96974283496102e+39, 2.9010782607422675e+39, 1.850510275195363e+40, 9.6248850296756142e+41, 
                         2.363777967480547e+40, 2.0084387958984933e+39, 4.0512098789063619e+39, 8.2208661483405048e+40, 
                         1.361275183886756e+40, 1.9569403652344284e+40, 1.0691074205859607e+41, 6.4544699765626766e+39, 
                         9.3727143808596309e+39, 5.7849903779298471e+39, 7.278444867187699e+39, 8.6242705218757034e+40, 
                         4.9095170566407596e+39, 2.1629340878906853e+39, 3.2615672753907154e+39, 3.3473979931641547e+39, 
                         2.5405892460938205e+39, 4.4288650371094965e+39, 2.9027948750977898e+40, 9.5787081035158877e+39, 
                         6.675054921238865e+41, 2.162934087890685e+39, 3.8349164701174595e+40, 6.7806267041017492e+39, 
                         8.6002379208986736e+39, 2.1698005453125592e+40, 7.3591257418951737e+40, 2.3689278105469409e+39, 
                         7.1067834316408205e+39, 2.2161491329102189e+40, 2.3929604115235122e+40, 6.9007897089845649e+39])
In [8]:
Surf_Area = Surface_Area / (3.0856e18)**2

Mass Accretion Rate

In [15]:
min_SA = np.min(Surf_Area)
max_SA = np.max(Surf_Area)

big_circle   = 100
small_circle = 10
In [16]:
print(min_SA)
print(max_SA)
183.905052142
101091.885966
In [17]:
# Make circle sizes consistent between the two plots. With and without self-gravity.
min_SA = 182
max_SA = 1.7e5
In [18]:
m = (big_circle - small_circle) / (max_SA - min_SA)
b = small_circle - min_SA * m
In [19]:
def calculate_circle_size(Surf_Area):
    
    Surf_Area = np.log10(Surf_Area)
    
    min_SA = np.min(Surf_Area)
    max_SA = np.max(Surf_Area)

    big_circle   = 500
    small_circle = 50
    
    m = (big_circle - small_circle) / (max_SA - min_SA)
    b = small_circle - min_SA * m
    
    circle_size = m * Surf_Area + b
    
    return circle_size
In [20]:
circle_size = calculate_circle_size(Surf_Area)
In [21]:
nism = 1.0
vism = 10.
In [27]:
M_here = np.array([1.0e2, 3.0e6])
#Mdot_G = 8.51e-8 * (nism/1.0)*(M_here/10.)**(1.15)
#Mdot_T = 4.1e-7 * (nism/1.0)*(vism/1.0)*(M_here/10.0)**(0.87)

Mdot_G = 6.0e-6   * (nism/1.0)*(M_here/1.0e3)**(1.25)
Mdot_T = 1.026e-4 * (nism/1.0)*(vism/10.0)*(M_here/1.0e3)
In [28]:
csize_scale = np.logspace(np.log10(min_SA), np.log10(max_SA), num=5)
scale_sizes = calculate_circle_size(csize_scale)
csx = np.logspace(2.3, 4, num=5)
csy = np.array([3.0e-1, 3.0e-1, 3.0e-1, 3.0e-1, 3.0e-1])

size_text = []
for i in range(len(csize_scale)):
    size_text.append("%.1e" %csize_scale[i])
In [29]:
import matplotlib.patches as patches
In [32]:
cmtopc  = 3.2407557442396e-19
kmtopc  = 3.24078e-14
gtoMsun = 5.0e-34
stoMyr  = 1.0/3.15e13
stoyr  = 1.0/3.15e7


rho_inf = 1.0 * 2.35 * 1.6733e-24 # g cm-3
vinf    = 7.5                     # km s-1

Mass_ZA = np.array([1.0e2, 3.8e4, 6.0e4, 8.0e4]) # Msun

Radius  = np.array([64.0, 64.0, 58., 48.])       # pc

Macc_ZA = 2.0*rho_inf * vinf * np.pi * Radius**2  * (gtoMsun / cmtopc**3 * kmtopc / stoyr)
In [40]:
Masses = np.logspace(np.log10(5.0e2), np.log10(2.0e6))

cmtopc  = 3.2407557442396e-19
gtoMsun = 5.0e-34
stoMyr  = 1.0/3.15e13

Gnewton   = 6.67259E-8 * cmtopc**3 * gtoMsun**(-1)* stoMyr**(-2)
Sigma_low = 8.0
Sigma_high= 16.0
M0        = 5.0e4

#Macc_low  = 4.64 * Gnewton**2 * Sigma_low**3 * np.log10(Masses/M0)**3 
#Macc_high = 4.64 * Gnewton**2 * Sigma_high**3 * np.log10(Masses/M0)**3

Macc_low  = 81.48 * Gnewton**2 * Sigma_low**3 * ((np.log10(Masses) - 4.69)/2.5225225225225215e-02)**3 /1.0e6
Macc_high = 81.48 * Gnewton**2 * Sigma_high**3 * ((np.log10(Masses) - 4.69)/4.4848484848484836e-02)**3/1.0e6
In [42]:
fig  = plt.figure(figsize=(10,9))

ax   = fig.add_axes([0.09, 0.06, 0.9, 0.93])

R    = 40.0
mdot = 4*math.pi*(R*3.08e18)**2 * (7*1.0e5) * (10 * mm.value) / 1.98e33 * 3.155e7

Fukui_Mdot = np.array([mdot, mdot])
Fukui_M    = np.array([1.0e4, 3e6])

ax.text(1.0e4, 0.052, "Fukui & Kawamura", fontsize=12)
ax.plot(Fukui_M, Fukui_Mdot, ':k', linewidth=3)

# 1 pc resolution clouds.

ax.plot(Mass_ZA, Macc_ZA, "-b", linewidth=2, label="Zamora-Aviles (2012)")

ax.plot(Masses, Macc_low, "-r", linewidth=2,  label="G11 $\Sigma_{res}=8$  M$_{\odot}$pc$^{-2}$")
ax.plot(Masses, Macc_high,"--r", linewidth=2, label="G11 $\Sigma_{res}=16$M$_{\odot}$pc$^{-2}$")

ax.scatter(M_NOSG_1pc, Mdot_NOSG_1pc, s=circle_size, alpha=0.8, c='#1f78b4', edgecolor="k", linewidth='2', label="0.95 pc simulation")

ax.plot(M_here, Mdot_G, "-k", linewidth=2, label="Grav. Accretion. $\dot{M} \propto M^{\,1.25}$")
ax.plot(M_here, Mdot_T, "--k", linewidth=2, label="Turb. Accretion. $\dot{M} \propto M$")


ax.scatter(csx, csy, s=scale_sizes, alpha=0.8, c='#1f78b4', edgecolor="k", linewidth='2')
ax.plot([2.0e2, 1.0e4], [2.0e-1, 2.0e-1], "-k", linewidth=2)
for i in range(len(size_text)):
    if i%2 ==0:
        ax.plot([csx[i], csx[i]], [1.9e-1, 2.1e-1], "-k", linewidth=2)
        ax.text(csx[i]*0.7, csy[i]*0.5, size_text[i], rotation=15, fontsize=13)

ax.text(2.1e4, 1.4e-1, "pc$^{2}$", fontsize=14, rotation=15)

ax.add_patch( patches.Rectangle(
        (1.25e2, 1.0e-1),
        3.3e4,
        3.0e-1,
        fill=False      # remove background
    )
)


ax.set_xscale("log")
ax.set_yscale("log")

ax.set_xlim(1.0e2, 3.0e6)
ax.set_ylim(1.0e-6, 5.0e-1)

ax.set_ylabel("Mass Accretion rate [M$_{\odot}$ yr$^{-1}$]", fontsize=15)
ax.set_xlabel("Cloud Mass [M$_{\odot}$]", fontsize=15)

ax.xaxis.set_tick_params(which="minor", width=1.5, length=3.0, direction="in")
ax.xaxis.set_tick_params(which="major", width=1.5, length=6.0, direction="in")

ax.yaxis.set_tick_params(which="minor", width=1.5, length=3.0, direction="in")
ax.yaxis.set_tick_params(which="major", width=1.5, length=6.0, direction="in")

ax.legend(loc=4, fontsize=15, framealpha=1.0, fancybox=True)


for tick in ax.xaxis.get_major_ticks():
    tick.label.set_fontsize(15) 
for tick in ax.yaxis.get_major_ticks():
    tick.label.set_fontsize(15) 

fig.show()

#save_dir = "/home/jcibanezm/codes/StratBox/AccretingClouds_Paper/Plots/"
save_dir = "/home/jcibanezm/Dropbox/Projects/Papers/Submitted/AccretionPaper/Figures/"

fig.savefig(save_dir + "Mass_Acc_Cloud_Pop_NOSG.pdf", format='pdf')
/home/jcibanezm/codes/libs/yt3.4/yt-conda/lib/python3.6/site-packages/matplotlib/figure.py:403: UserWarning: matplotlib is currently using a non-GUI backend, so cannot show the figure
  "matplotlib is currently using a non-GUI backend, "
In [ ]: