In [16]:
%matplotlib inline

import matplotlib.pyplot as plt
import matplotlib.patches as mpatches

import pandas as pd

In [17]:
import json
from pprint import pprint

with open('/Users/danielkershaw/PycharmProjects/DiffusionSimulation/output/twitter-geo-simulation') as data_file:    
    data = json.load(data_file)
    
result_act = pd.read_json(data["result_act"])
result_user = pd.read_json(data["result_user"])

In [18]:
result_act


Out[18]:
ActivateionExposure ActivateionExposure_m1 ActivateionExposure_m2 ActivateionExposure_m3 ActivateionExposure_m4 UserExposure UserExposure_m1 UserExposure_m2 UserExposure_m3 UserExposure_m4 ... userUsageEntorpy userUsageEntorpy_m1 userUsageEntorpy_m2 userUsageEntorpy_m3 userUsageEntorpy_m4 userusagedominance userusagedominance_m1 userusagedominance_m2 userusagedominance_m3 userusagedominance_m4
0 1.000000 0.000000 1.000000 0.500000 0.875000 1.000000 0.000000 1.000000 0.500000 0.875000 ... 0.000000 0.000000 0.000000 0.000000 0.000000 1.000000 1.000000 1.000000 1.000000 1.000000
1 0.757812 0.000000 1.035156 1.042969 1.210938 0.757812 0.000000 1.035156 1.042969 1.210938 ... 0.633580 0.606504 0.674194 0.005415 0.154334 0.542969 0.562500 0.513672 0.996094 0.888672
2 0.921875 0.003906 1.519531 0.781250 2.230469 0.921875 0.003906 1.519531 0.718750 2.230469 ... 0.880641 1.008359 1.057981 0.329326 0.141724 0.489583 0.398438 0.360677 0.826823 0.925781
3 1.152344 0.761719 2.058594 0.425781 3.148438 1.152344 0.761719 2.042969 0.425781 3.148438 ... 0.863720 1.051905 1.204843 0.650037 0.140126 0.543945 0.491211 0.378581 0.681641 0.936523
4 2.109375 0.574219 1.371094 0.976562 1.527344 2.109375 0.574219 1.371094 0.890625 1.527344 ... 0.977866 1.153477 1.355360 0.964550 0.390375 0.471094 0.400000 0.303906 0.517578 0.835156
5 1.488281 0.046875 1.308594 1.226562 3.812500 1.488281 0.046875 1.308594 1.156250 3.812500 ... 1.125034 1.367037 1.435824 0.990104 0.381700 0.444271 0.356771 0.346745 0.453776 0.847005
6 1.386719 0.089844 2.093750 0.593750 3.992188 1.386719 0.089844 2.093750 0.593750 3.976562 ... 1.081577 1.557282 1.430678 1.177269 0.350726 0.518787 0.311384 0.318638 0.385026 0.868862
7 3.144531 1.121094 1.742188 1.304688 2.609375 3.144531 1.121094 1.742188 1.234375 2.593750 ... 1.036001 1.575509 1.422250 1.157802 0.328464 0.570243 0.343750 0.346470 0.418601 0.883022
8 3.222656 1.375000 2.480469 2.660156 5.761719 3.207031 1.375000 2.449219 1.347656 5.621094 ... 1.068717 1.616901 1.561552 1.112736 0.401114 0.583984 0.305556 0.312066 0.492355 0.833767
9 2.183594 0.878906 3.070312 1.207031 5.875000 2.183594 0.878906 3.070312 1.199219 5.750000 ... 1.142643 1.625372 1.615531 1.154256 0.385470 0.553602 0.278906 0.293533 0.490380 0.848437
10 2.542969 0.773438 4.980469 3.074219 4.589844 2.542969 0.773438 4.964844 1.308594 4.449219 ... 1.217545 1.639816 1.588588 1.124368 0.424430 0.546520 0.262784 0.312216 0.512119 0.811222
11 3.398438 0.289062 6.894531 1.898438 3.406250 3.398438 0.289062 6.894531 1.875000 3.261719 ... 1.253881 1.733015 1.582730 1.151363 0.539219 0.531635 0.268229 0.287257 0.526469 0.780185
12 3.835938 1.015625 4.843750 2.300781 6.328125 3.820312 1.015625 4.824219 0.886719 6.183594 ... 1.241104 1.754424 1.581487 1.251250 0.560207 0.553486 0.247596 0.329452 0.500682 0.755891
13 3.328125 0.933594 3.265625 1.992188 3.757812 3.312500 0.933594 3.214844 1.261719 3.722656 ... 1.274464 1.832703 1.618318 1.339372 0.693407 0.550824 0.229911 0.307864 0.478246 0.723608
14 1.816406 1.804688 3.988281 1.671875 6.617188 1.816406 1.804688 3.968750 1.421875 6.488281 ... 1.392950 1.817647 1.626577 1.338564 0.705961 0.518750 0.253125 0.322228 0.473906 0.703437
15 2.867188 1.605469 4.058594 1.757812 6.332031 2.867188 1.605469 4.054688 1.320312 6.187500 ... 1.402779 1.804907 1.653374 1.343625 0.745240 0.530452 0.253418 0.310563 0.463068 0.684959
16 2.710938 1.250000 4.101562 1.742188 7.472656 2.710938 1.250000 4.101562 1.566406 7.328125 ... 1.414150 1.824724 1.642237 1.356366 0.740301 0.516444 0.238741 0.322093 0.478672 0.670007
17 7.546875 0.167969 4.281250 2.570312 5.257812 7.464844 0.167969 4.246094 1.527344 5.226562 ... 1.394576 1.874949 1.708250 1.386007 0.776452 0.531429 0.246311 0.321729 0.461850 0.658446
18 6.722656 3.308594 7.007812 2.898438 5.867188 6.707031 3.308594 6.992188 2.062500 5.847656 ... 1.434318 1.856012 1.681596 1.397563 0.796554 0.506990 0.266653 0.342002 0.461823 0.646873
19 5.925781 1.332031 3.734375 2.148438 8.425781 5.863281 1.332031 3.718750 1.847656 8.140625 ... 1.455905 1.844228 1.715108 1.413465 0.781844 0.498119 0.258984 0.326891 0.451086 0.661453
20 5.019531 0.980469 6.031250 1.921875 10.871094 4.957031 0.980469 6.027344 1.246094 10.460938 ... 1.519303 1.872750 1.729456 1.481425 0.779209 0.478181 0.249814 0.311477 0.427478 0.652122
21 6.792969 0.421875 7.117188 4.406250 6.695312 6.773438 0.421875 7.113281 3.359375 6.675781 ... 1.501802 1.905175 1.738900 1.475397 0.765896 0.485931 0.241300 0.300663 0.440807 0.667970
22 4.492188 3.796875 7.707031 3.175781 7.847656 4.441406 3.796875 7.703125 2.281250 7.437500 ... 1.530541 1.893276 1.727853 1.500400 0.778321 0.465816 0.263587 0.300534 0.429321 0.659340
23 9.031250 2.812500 7.980469 3.003906 10.078125 9.000000 2.812500 7.980469 2.460938 9.667969 ... 1.516337 1.906893 1.709481 1.503389 0.768549 0.473017 0.257975 0.318147 0.427364 0.670300
24 5.125000 1.835938 4.769531 2.878906 8.652344 5.027344 1.835938 4.769531 1.695312 8.257812 ... 1.584062 1.902201 1.714837 1.518995 0.764351 0.454733 0.247812 0.306797 0.434781 0.663533
25 3.714844 3.582031 4.609375 3.773438 9.246094 3.691406 3.582031 4.609375 2.835938 8.742188 ... 1.600760 1.897917 1.745476 1.518995 0.784991 0.449430 0.241454 0.295559 0.434781 0.656633
26 10.203125 4.554688 6.609375 4.742188 15.996094 10.156250 4.554688 6.542969 1.937500 15.464844 ... 1.624378 1.902437 1.740652 1.498025 0.797093 0.438073 0.242922 0.303369 0.449043 0.648404
27 6.359375 1.605469 2.078125 3.781250 11.761719 6.343750 1.605469 2.074219 2.632812 11.230469 ... 1.618441 1.953365 1.739981 1.498778 0.792568 0.445540 0.234241 0.302714 0.448779 0.642992
28 15.539062 0.703125 7.000000 1.476562 7.046875 15.476562 0.703125 7.000000 1.441406 6.667969 ... 1.597160 1.968680 1.745052 1.490280 0.787412 0.460692 0.226716 0.306390 0.453592 0.654255
29 8.910156 2.765625 11.054688 2.328125 12.156250 8.878906 2.765625 11.050781 2.140625 12.015625 ... 1.607944 1.981290 1.734601 1.474438 0.785649 0.453210 0.228026 0.322328 0.463097 0.663589
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
9969 371.296875 1118.382812 565.976562 1188.558594 157.839844 88.886719 496.492188 150.472656 69.218750 60.496094 ... 2.260444 2.260444 2.260444 2.257398 2.260444 0.212962 0.212962 0.212962 0.192029 0.212962
9970 371.296875 1118.382812 565.976562 2323.269531 157.839844 88.886719 496.492188 150.472656 153.238281 60.496094 ... 2.260444 2.260444 2.260444 2.257402 2.260444 0.212962 0.212962 0.212962 0.192028 0.212962
9971 371.296875 1118.382812 565.976562 1488.273438 157.839844 88.886719 496.492188 150.472656 136.812500 60.496094 ... 2.260444 2.260444 2.260444 2.257402 2.260444 0.212962 0.212962 0.212962 0.192028 0.212962
9972 371.296875 1118.382812 565.976562 600.535156 157.839844 88.886719 496.492188 150.472656 128.910156 60.496094 ... 2.260444 2.260444 2.260444 2.257231 2.260444 0.212962 0.212962 0.212962 0.191967 0.212962
9973 371.296875 1118.382812 565.976562 595.628906 157.839844 88.886719 496.492188 150.472656 140.523438 60.496094 ... 2.260444 2.260444 2.260444 2.257191 2.260444 0.212962 0.212962 0.212962 0.192019 0.212962
9974 371.296875 1118.382812 565.976562 332.058594 157.839844 88.886719 496.492188 150.472656 37.617188 60.496094 ... 2.260444 2.260444 2.260444 2.257191 2.260444 0.212962 0.212962 0.212962 0.192019 0.212962
9975 371.296875 1118.382812 565.976562 1315.238281 157.839844 88.886719 496.492188 150.472656 116.964844 60.496094 ... 2.260444 2.260444 2.260444 2.257192 2.260444 0.212962 0.212962 0.212962 0.192019 0.212962
9976 371.296875 1118.382812 565.976562 1573.148438 157.839844 88.886719 496.492188 150.472656 121.707031 60.496094 ... 2.260444 2.260444 2.260444 2.257183 2.260444 0.212962 0.212962 0.212962 0.191995 0.212962
9977 371.296875 1118.382812 565.976562 1196.570312 157.839844 88.886719 496.492188 150.472656 149.460938 60.496094 ... 2.260444 2.260444 2.260444 2.257181 2.260444 0.212962 0.212962 0.212962 0.191998 0.212962
9978 371.296875 1118.382812 565.976562 1967.707031 157.839844 88.886719 496.492188 150.472656 225.875000 60.496094 ... 2.260444 2.260444 2.260444 2.257181 2.260444 0.212962 0.212962 0.212962 0.191998 0.212962
9979 371.296875 1118.382812 565.976562 1835.468750 157.839844 88.886719 496.492188 150.472656 122.777344 60.496094 ... 2.260444 2.260444 2.260444 2.257171 2.260444 0.212962 0.212962 0.212962 0.192009 0.212962
9980 371.296875 1118.382812 565.976562 1511.937500 157.839844 88.886719 496.492188 150.472656 116.273438 60.496094 ... 2.260444 2.260444 2.260444 2.257168 2.260444 0.212962 0.212962 0.212962 0.192012 0.212962
9981 371.296875 1118.382812 565.976562 900.183594 157.839844 88.886719 496.492188 150.472656 90.636719 60.496094 ... 2.260444 2.260444 2.260444 2.257168 2.260444 0.212962 0.212962 0.212962 0.192012 0.212962
9982 371.296875 1118.382812 565.976562 1472.992188 157.839844 88.886719 496.492188 150.472656 166.363281 60.496094 ... 2.260444 2.260444 2.260444 2.257174 2.260444 0.212962 0.212962 0.212962 0.192011 0.212962
9983 371.296875 1118.382812 565.976562 995.613281 157.839844 88.886719 496.492188 150.472656 122.386719 60.496094 ... 2.260444 2.260444 2.260444 2.257174 2.260444 0.212962 0.212962 0.212962 0.192010 0.212962
9984 371.296875 1118.382812 565.976562 1056.210938 157.839844 88.886719 496.492188 150.472656 270.082031 60.496094 ... 2.260444 2.260444 2.260444 2.257065 2.260444 0.212962 0.212962 0.212962 0.192152 0.212962
9985 371.296875 1118.382812 565.976562 1387.386719 157.839844 88.886719 496.492188 150.472656 206.171875 60.496094 ... 2.260444 2.260444 2.260444 2.257065 2.260444 0.212962 0.212962 0.212962 0.192151 0.212962
9986 371.296875 1118.382812 565.976562 921.121094 157.839844 88.886719 496.492188 150.472656 67.113281 60.496094 ... 2.260444 2.260444 2.260444 2.257095 2.260444 0.212962 0.212962 0.212962 0.192143 0.212962
9987 371.296875 1118.382812 565.976562 1089.656250 157.839844 88.886719 496.492188 150.472656 171.714844 60.496094 ... 2.260444 2.260444 2.260444 2.257087 2.260444 0.212962 0.212962 0.212962 0.192119 0.212962
9988 232.593750 530.765625 285.953125 2657.757812 142.679688 54.773438 233.984375 62.945312 179.515625 46.992188 ... 2.260452 2.260452 2.260452 2.291899 2.260452 0.212878 0.212878 0.212878 0.189014 0.212878
9989 232.593750 530.765625 285.953125 1662.953125 142.679688 54.773438 233.984375 62.945312 86.085938 46.992188 ... 2.260452 2.260452 2.260452 2.291899 2.260452 0.212878 0.212878 0.212878 0.189014 0.212878
9990 240.781250 535.593750 285.468750 2370.437500 148.656250 56.500000 236.296875 62.671875 109.125000 48.859375 ... 2.260447 2.260447 2.260447 2.291745 2.260447 0.212881 0.212881 0.212881 0.189101 0.212881
9991 240.781250 535.593750 285.468750 1824.656250 148.656250 56.500000 236.296875 62.671875 118.703125 48.859375 ... 2.260447 2.260447 2.260447 2.291744 2.260447 0.212881 0.212881 0.212881 0.189099 0.212881
9992 240.781250 535.593750 285.468750 1663.281250 148.656250 56.500000 236.296875 62.671875 93.343750 48.859375 ... 2.260447 2.260447 2.260447 2.291772 2.260447 0.212881 0.212881 0.212881 0.189086 0.212881
9993 251.562500 541.187500 512.937500 1206.156250 270.312500 55.000000 238.593750 114.343750 95.781250 86.718750 ... 2.260280 2.260280 2.260280 2.271779 2.260280 0.213045 0.213045 0.213045 0.193223 0.213045
9994 251.562500 541.187500 512.937500 1394.093750 270.312500 55.000000 238.593750 114.343750 82.031250 86.718750 ... 2.260280 2.260280 2.260280 2.271853 2.260280 0.213045 0.213045 0.213045 0.193194 0.213045
9995 353.875000 587.875000 457.875000 992.187500 329.375000 79.250000 260.437500 102.187500 148.000000 103.437500 ... 2.260281 2.260281 2.260281 2.275661 2.260281 0.213045 0.213045 0.213045 0.191794 0.213045
9996 529.750000 707.750000 341.250000 1623.000000 465.000000 120.750000 316.750000 86.500000 192.000000 147.500000 ... 2.260262 2.260262 2.260262 2.274892 2.260262 0.213045 0.213045 0.213045 0.190090 0.213045
9997 529.750000 707.750000 341.250000 1408.000000 465.000000 120.750000 316.750000 86.500000 91.000000 147.500000 ... 2.260262 2.260262 2.260262 2.274892 2.260262 0.213045 0.213045 0.213045 0.190090 0.213045
9998 847.500000 1067.500000 548.500000 1211.500000 680.000000 202.500000 480.500000 137.000000 116.500000 210.000000 ... 2.260347 2.260347 2.260347 2.264643 2.260347 0.213045 0.213045 0.213045 0.188789 0.213045

9999 rows × 50 columns


In [19]:
with open('/Users/danielkershaw/PycharmProjects/DiffusionSimulation/output/twitter-geo-innovation') as data_file:    
    data = json.load(data_file)
    
result_act_real = pd.read_json(data["result_act"])
result_user_real = pd.read_json(data["result_user"])

In [20]:
result_act = result_act.join(result_act_real, rsuffix="_m6")
result_user = result_user.join(result_user_real, rsuffix="_m6")

In [22]:
fig, axes = plt.subplots(nrows=3, ncols=2,figsize=(15,15))

def ratio(n, w):
    if n == 0:
        return 0
    
    if w == 0:
        return 0
    
    return  n/w

def rowRatio(data):
    d = {
        "m1":ratio(data["m1"], data["m1"]),
        "m2":ratio(data["m2"], data["m1"]),
        "m3":ratio(data["m3"], data["m1"]),
        "m4":ratio(data["m4"], data["m1"]),
        "m5":ratio(data["m5"], data["m1"]),
        "m6":ratio(data["m6"], data["m1"])
    }
    return pd.Series(d)

usagedominance = result_act[["usagedominance_m1","usagedominance_m2","usagedominance_m3","usagedominance_m4","usagedominance", "usagedominance_m6"]]
usagedominance.columns = ['m1', 'm2', 'm3', 'm4', 'm5', 'm6']
usagedominance = usagedominance.apply(rowRatio,1)

plts = usagedominance.plot(ax=axes[0,0])
plts.set_xlabel('')
plts.set_ylabel(r'$\frac{r}{r_{M1}}$', rotation=0)

userusagedominance = result_user[["userusagedominance_m1","userusagedominance_m2","userusagedominance_m3","userusagedominance_m4","userusagedominance","userusagedominance_m6"]]
userusagedominance.columns = ['m1', 'm2', 'm3', 'm4', 'm5', 'm6']
userusagedominance = userusagedominance.apply(rowRatio,1)

plts = userusagedominance.plot(ax=axes[0,1])
plts.set_xlabel('')
plts.set_ylabel(r'$\frac{g}{g_{M1}}$', rotation=0)

usageEntorpy = result_act[["usageEntorpy_m1","usageEntorpy_m2","usageEntorpy_m3","usageEntorpy_m4","usageEntorpy","usageEntorpy_m6"]]
usageEntorpy.columns =['m1', 'm2', 'm3', 'm4', 'm5', 'm6']
usageEntorpy = usageEntorpy.apply(rowRatio,1)

plts = usageEntorpy.plot(ax=axes[1,0])
plts.set_xlabel('')
plts.set_ylabel(r'$\frac{H^p}{N_{M1}^p}$', rotation=0)

userUsageEntorpy = result_user[["userUsageEntorpy_m1","userUsageEntorpy_m2","userUsageEntorpy_m3","userUsageEntorpy_m4","userUsageEntorpy","userUsageEntorpy_m6"]]
userUsageEntorpy.columns = ['m1', 'm2', 'm3', 'm4', 'm5', 'm6']
userUsageEntorpy = userUsageEntorpy.apply(rowRatio,1)

plts = userUsageEntorpy.plot(ax=axes[1,1])
plts.set_xlabel('')
plts.set_ylabel(r'$\frac{H^u}{N_{M1}^u}$', rotation=0)

ActivateionExposure = result_act[["ActivateionExposure_m1","ActivateionExposure_m2","ActivateionExposure_m3","ActivateionExposure_m4","ActivateionExposure","ActivateionExposure_m6"]]
ActivateionExposure.columns = ['m1', 'm2', 'm3', 'm4', 'm5', 'm6']
ActivateionExposure.loc[:, 'm1'] = ActivateionExposure.loc[:, 'm1'].rolling(window=100,center=False).mean()
ActivateionExposure.loc[:, 'm2'] = ActivateionExposure.loc[:, 'm2'].rolling(window=100,center=False).mean()
ActivateionExposure.loc[:, 'm3'] = ActivateionExposure.loc[:, 'm3'].rolling(window=100,center=False).mean()
ActivateionExposure.loc[:, 'm4'] = ActivateionExposure.loc[:, 'm4'].rolling(window=100,center=False).mean()
ActivateionExposure.loc[:, 'm5'] = ActivateionExposure.loc[:, 'm5'].rolling(window=100,center=False).mean()
ActivateionExposure.loc[:, 'm6'] = ActivateionExposure.loc[:, 'm6'].rolling(window=100,center=False).mean()

ActivateionExposure = ActivateionExposure.apply(rowRatio,1)

plts = ActivateionExposure.plot(ax=axes[2,0])
plts.set_xlabel('Posts (P)')
plts.set_ylabel(r'$\frac{N^p}{N_{M1}^p}$', rotation=0)

UserExposure = result_user[["UserExposure_m1","UserExposure_m2","UserExposure_m3","UserExposure_m4","UserExposure","UserExposure_m6"]]
UserExposure.columns = ['m1', 'm2', 'm3', 'm4', 'm5', 'm6']
UserExposure.loc[:, 'm1'] = UserExposure.loc[:, 'm1'].rolling(window=100,center=False).mean()
UserExposure.loc[:, 'm2'] = UserExposure.loc[:, 'm2'].rolling(window=100,center=False).mean()
UserExposure.loc[:, 'm3'] = UserExposure.loc[:, 'm3'].rolling(window=100,center=False).mean()
UserExposure.loc[:, 'm4'] = UserExposure.loc[:, 'm4'].rolling(window=100,center=False).mean()
UserExposure.loc[:, 'm5'] = UserExposure.loc[:, 'm5'].rolling(window=100,center=False).mean()
UserExposure.loc[:, 'm6'] = UserExposure.loc[:, 'm6'].rolling(window=100,center=False).mean()
UserExposure = UserExposure.apply(rowRatio,1)

plts = UserExposure.plot(ax=axes[2,1])
plts.set_xlabel('Users (U)')
plts.set_ylabel(r'$\frac{N^u}{N_{M1}^u}$', rotation=0)


Out[22]:
<matplotlib.text.Text at 0x117a6d190>

In [23]:
fig, axes = plt.subplots(nrows=3, ncols=2,figsize=(15,15))

def ratio(n, w):
    if n == 0:
        return 0
    
    if w == 0:
        return 0
    
    return  n/w

def rowRatio(data):
    d = {
        "m1":ratio(data["m1"], data["m1"]),
        "m2":ratio(data["m2"], data["m1"]),
        "m3":ratio(data["m3"], data["m1"]),
        "m4":ratio(data["m4"], data["m1"]),
        "m5":ratio(data["m5"], data["m1"])
    }
    return pd.Series(d)

usagedominance = result_act[["usagedominance_m1","usagedominance_m2","usagedominance_m3","usagedominance_m4","usagedominance"]]
usagedominance.columns = ['m1', 'm2', 'm3', 'm4', 'm5']
# usagedominance = usagedominance.apply(rowRatio,1)

plt = usagedominance.plot(ax=axes[0,0])
plt.set_xlabel('')
plt.set_ylabel(r'$\frac{r}{r_{M1}}$', rotation=0)

userusagedominance = result_user[["userusagedominance_m1","userusagedominance_m2","userusagedominance_m3","userusagedominance_m4","userusagedominance"]]
userusagedominance.columns = ['m1', 'm2', 'm3', 'm4', 'm5']
# userusagedominance = userusagedominance.apply(rowRatio,1)

plt = userusagedominance.plot(ax=axes[0,1])
plt.set_xlabel('')
plt.set_ylabel(r'$\frac{g}{g_{M1}}$', rotation=0)

usageEntorpy = result_act[["usageEntorpy_m1","usageEntorpy_m2","usageEntorpy_m3","usageEntorpy_m4","usageEntorpy"]]
usageEntorpy.columns = ['m1', 'm2', 'm3', 'm4', 'm5']
# usageEntorpy = usageEntorpy.apply(rowRatio,1)

plt = usageEntorpy.plot(ax=axes[1,0])
plt.set_xlabel('')
plt.set_ylabel(r'$\frac{H^p}{N_{M1}^p}$', rotation=0)

userUsageEntorpy = result_user[["userUsageEntorpy_m1","userUsageEntorpy_m2","userUsageEntorpy_m3","userUsageEntorpy_m4","userUsageEntorpy"]]
userUsageEntorpy.columns = ['m1', 'm2', 'm3', 'm4', 'm5']
# userUsageEntorpy = userUsageEntorpy.apply(rowRatio,1)

plt = userUsageEntorpy.plot(ax=axes[1,1])
plt.set_xlabel('')
plt.set_ylabel(r'$\frac{H^u}{N_{M1}^u}$', rotation=0)

ActivateionExposure = result_act[["ActivateionExposure_m1","ActivateionExposure_m2","ActivateionExposure_m3","ActivateionExposure_m4","ActivateionExposure"]]
ActivateionExposure.columns = ['m1', 'm2', 'm3', 'm4', 'm5']
ActivateionExposure.loc[:, 'm1'] = ActivateionExposure.loc[:, 'm1'].rolling(window=100,center=False).mean()
ActivateionExposure.loc[:, 'm2'] = ActivateionExposure.loc[:, 'm2'].rolling(window=100,center=False).mean()
ActivateionExposure.loc[:, 'm3'] = ActivateionExposure.loc[:, 'm3'].rolling(window=100,center=False).mean()
ActivateionExposure.loc[:, 'm4'] = ActivateionExposure.loc[:, 'm4'].rolling(window=100,center=False).mean()
ActivateionExposure.loc[:, 'm5'] = ActivateionExposure.loc[:, 'm5'].rolling(window=100,center=False).mean()
# ActivateionExposure = ActivateionExposure.apply(rowRatio,1)

plt = ActivateionExposure.plot(ax=axes[2,0])
plt.set_xlabel('Posts (P)')
plt.set_ylabel(r'$\frac{N^p}{N_{M1}^p}$', rotation=0)

UserExposure = result_user[["UserExposure_m1","UserExposure_m2","UserExposure_m3","UserExposure_m4","UserExposure"]]
UserExposure.columns = ['m1', 'm2', 'm3', 'm4', 'm5']
UserExposure.loc[:, 'm1'] = UserExposure.loc[:, 'm1'].rolling(window=100,center=False).mean()
UserExposure.loc[:, 'm2'] = UserExposure.loc[:, 'm2'].rolling(window=100,center=False).mean()
UserExposure.loc[:, 'm3'] = UserExposure.loc[:, 'm3'].rolling(window=100,center=False).mean()
UserExposure.loc[:, 'm4'] = UserExposure.loc[:, 'm4'].rolling(window=100,center=False).mean()
UserExposure.loc[:, 'm5'] = UserExposure.loc[:, 'm5'].rolling(window=100,center=False).mean()
# UserExposure = UserExposure.apply(rowRatio,1)

plt = UserExposure.plot(ax=axes[2,1])
plt.set_xlabel('Users (U)')
plt.set_ylabel(r'$\frac{N^u}{N_{M1}^u}$', rotation=0)


Out[23]:
<matplotlib.text.Text at 0x115f66890>

In [ ]: