File size: 1,861 Bytes
1da285f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import pandas as pd
from matplotlib import pyplot as plt, ticker

GUIDED_RESULT = './guided_interact.csv'
RANDOM_RESULT = './random_interact.csv'

def format_func(x, pos):
    return format(int(x), ',').replace(',', ' ')

def main():

    plt.rcParams['font.size'] = 19

    # Load the data
    guided_interact = pd.read_csv(GUIDED_RESULT)
    random_interact = pd.read_csv(RANDOM_RESULT)
    guided_interact = guided_interact[1:]
    random_interact = random_interact[1:]

    # Plotting effective_interacts_rate and coverage_rate
    fig, ax1 = plt.subplots()

    # Plot effective_interacts_rate
    color = 'tab:red'
    ax1.set_xlabel('time/min')
    ax1.set_xticks(guided_interact.index[9::10].astype(int))
    ax1.set_xticklabels(guided_interact.index[9::10].astype(int))
    ax1.set_ylabel('Rate of Effective Interactions', color=color)
    # lge = ax1.plot(guided_interact.index, guided_interact['effective_interacts_cnt'], color=color, label='Guided')
    lre = ax1.plot(random_interact.index, random_interact['effective_interacts_rate'], color=color, label='Random')
    ax1.set_xlim(0, guided_interact.index[-1])
    ax1.set_ylim(0, 1.05)
    ax1.tick_params(axis='y', labelcolor=color)

    # Plot coverage_rate
    ax2 = ax1.twinx()
    color = 'tab:blue'
    ax2.set_ylabel('IVO Coverage', color=color)
    # lgc = ax2.plot(guided_interact.index, guided_interact['coverage_rate'], color=color, label='Guided')
    lrc = ax2.plot(random_interact.index, random_interact['coverage_rate'], color=color, label='Random')
    ax2.set_xlim(0, guided_interact.index[-1])
    ax2.set_ylim(0, 1.05)
    ax2.tick_params(axis='y', labelcolor=color)

    # Format y tick labels
    # ax1.yaxis.set_major_formatter(ticker.FuncFormatter(format_func))


    plt.savefig('./figure_random.png', dpi=300, bbox_inches='tight')


if __name__ == '__main__':
    main()