-
Notifications
You must be signed in to change notification settings - Fork 0
/
plot_multi.py
142 lines (124 loc) · 23.4 KB
/
plot_multi.py
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# coding:utf-8
from multi_process import draw_review_distance_multiprocess
import matplotlib.pyplot as plt
import collections
import file_util
import time
import summary_plot
class Plot:
def save_graph(self, dict, saveFilename, xlabel='Num Reviews', ylabel='Num Members', use_log=[True,True],log_base=[10,10], plot_type='rx', title=''):
"""
作图
给定的x_list和y_list作图,并根据一定的参数进行修饰
"""
x_list = dict.keys()
y_list = dict.values()
fig, ax = plt.subplots()
if use_log[0]:
ax.set_xscale('log', basex=log_base[0])
if use_log[1]:
ax.set_yscale('log', basey=log_base[1])
plt.plot(x_list, y_list, plot_type)
plt.ylabel(ylabel)
plt.xlabel(xlabel)
plt.title(title)
plt.axis([0, float(max(x_list))*1.2, 0, float(max(y_list))*1.2])
plt.savefig(saveFilename)
def multiprocess_putnum(self, test_dict, data_num):
"""
传入希望的总处理数据量,每次载入queue的数量量(dict形式)
然后计算不同的queue数据量下处理的时间,最后画图
"""
for put_num in test_dict.keys():
finish_time = draw_review_distance_multiprocess(list_num=data_num, put_num=put_num)
print put_num, "with finish_time", finish_time
test_dict[put_num] = finish_time
# test_dict = collections.OrderedDict(sorted(test_dict.items()))
print test_dict
# self.save_graph(test_dict, 'graphs/multi_process1.png', xlabel='Queue Put Number', ylabel='Cost Time', use_log=[False, False], plot_type='ro-')
def singleprocess_datanum(self, test_dict):
fu = file_util.FileUtil('../AmazonDataBackup/reviewsNew/reviewsNew.mP')
fu.get_structure()
for data_num in test_dict.keys():
print data_num
content_list = fu.get_content_list()[0:data_num]
content_list_2_grams = summary_plot.get_2_grams_list(content_list)
start = time.time()
jd_list = summary_plot.get_jd_list(content_list_2_grams)
summary_plot.get_reviews_similarity_relation(jd_list)
finish_time = time.time() - start
# print 'finish get relation with %s s' % finish_time
test_dict[data_num] = finish_time
# test_dict = collections.OrderedDict(sorted(test_dict.items()))
return test_dict
# self.save_graph(test_dict, 'graphs/single_distance_different_datanum', xlabel='Total Data Number', ylabel='Cost Time', use_log=[False, False], plot_type='bo-')
def multiprocess_datanum(self, test_dict, put_num):
for data_num in test_dict.keys():
# print data_num
finish_time = draw_review_distance_multiprocess(list_num=data_num, put_num=put_num)
test_dict[data_num] = finish_time
# test_dict = collections.OrderedDict(sorted(test_dict.items()))
return test_dict
# self.save_graph(test_dict, 'graphs/multi_process1.png', xlabel='Total Data Number', ylabel='Cost Time', use_log=[False, False], plot_type='ro-')
def multi_single_datanum(self, min_num, max_num, step, put_num):
# plot = Plot()
test_dict = {}
for x in xrange(min_num, max_num, step):
test_dict[x] = 0
# plot.multiprocess_putnum(test_dict, 2000)
single_dict = test_dict.copy()
single_dict = self.singleprocess_datanum(single_dict)
single_x_list = single_dict.keys()
single_y_list = single_dict.values()
multi_dict = self.multiprocess_datanum(test_dict, put_num)
multi_x_list = multi_dict.keys()
multi_y_list = multi_dict.values()
print single_dict
print '-------------------------'
print multi_dict
# plt.ylabel('Cost Time')
# plt.xlabel('Total Data Num')
# line_single, line_multi = plt.plot(single_x_list, single_y_list, 'bx-', multi_x_list, multi_y_list, 'ro-')
# plt.legend([line_single, line_multi], ['Single', 'Multi'])
# plt.savefig('graphs/single_multi.png')
def draw_two_lines(self, line1, line2, line1_name, line2_name, xlabel='', ylabel='', filename=''):
single_dict = line1
single_dict = collections.OrderedDict(sorted(single_dict.items()))
# -------------------------
multi_dict = line2
multi_dict = collections.OrderedDict(sorted(multi_dict.items()))
single_x_list = single_dict.keys()
single_y_list = single_dict.values()
multi_x_list = multi_dict.keys()
multi_y_list = multi_dict.values()
plt.ylabel(ylabel)
plt.xlabel(xlabel)
line_single, line_multi = plt.plot(single_x_list, single_y_list, 'bx-', multi_x_list, multi_y_list, 'rx-')
plt.legend([line_single, line_multi], [line1_name, line2_name], bbox_to_anchor=(0.5, 1))
plt.savefig('graphs/' + filename + '.png')
if __name__ == '__main__':
plot = Plot()
# test_dict = {}
# for x in xrange(1000, 100000, 1000):
# test_dict[x] = 0
# print str(test_dict)
# plot.multiprocess_putnum(test_dict, 1000)
# plot.multi_single_datanum(1000, 5000, 100, 20000)
plot.save_graph(collections.OrderedDict(sorted({128000: 19.81463313102722, 160000: 21.081717014312744, 168000: 22.348346948623657, 252000: 25.082547187805176, 336000: 25.468505859375, 42000: 18.817505836486816, 110000: 19.18031096458435, 194000: 23.153693914413452, 278000: 24.476943969726562, 362000: 26.582540035247803, 348000: 27.09394884109497, 84000: 19.187562942504883, 46000: 19.493875980377197, 304000: 25.375380039215088, 388000: 27.857498168945312, 162000: 20.100162982940674, 246000: 23.22539496421814, 330000: 23.45575499534607, 126000: 19.270339012145996, 188000: 22.411683082580566, 272000: 26.388715028762817, 356000: 26.414397954940796, 104000: 19.076249837875366, 124000: 18.93190097808838, 214000: 23.257671117782593, 298000: 25.30849599838257, 382000: 27.954083919525146, 200000: 23.260756969451904, 178000: 21.529160022735596, 18000: 23.825605869293213, 240000: 21.976758003234863, 324000: 23.952816009521484, 14000: 26.414932012557983, 182000: 21.530462980270386, 266000: 27.960168838500977, 350000: 26.855690002441406, 60000: 18.247766971588135, 106000: 18.778358936309814, 40000: 19.235347986221313, 208000: 22.615700006484985, 292000: 26.093460083007812, 376000: 28.443765878677368, 102000: 17.9149010181427, 66000: 18.542129039764404, 234000: 24.94533681869507, 318000: 26.6406729221344, 144000: 20.533079862594604, 88000: 18.56637215614319, 176000: 22.0626540184021, 260000: 24.548346996307373, 344000: 26.21404480934143, 202000: 24.00723886489868, 286000: 24.678972005844116, 58000: 18.573670148849487, 228000: 24.19322109222412, 312000: 25.166810035705566, 396000: 25.519543170928955, 36000: 19.090945959091187, 70000: 17.797744035720825, 262000: 23.397679090499878, 170000: 21.464282989501953, 254000: 23.688794136047363, 338000: 26.67580795288086, 78000: 18.830219984054565, 28000: 19.601558923721313, 196000: 23.20405912399292, 280000: 24.916033029556274, 364000: 26.41873788833618, 54000: 18.306936979293823, 138000: 20.2208571434021, 222000: 36.27754592895508, 120000: 20.04131317138672, 20000: 22.305625915527344, 164000: 21.41818904876709, 248000: 24.528424978256226, 332000: 25.985937118530273, 98000: 18.71520495414734, 22000: 21.74246096611023, 190000: 22.090204000473022, 274000: 24.676424026489258, 358000: 25.028383016586304, 92000: 18.349332094192505, 76000: 17.97584104537964, 34000: 18.59342098236084, 48000: 18.69089698791504, 132000: 18.945136070251465, 216000: 22.840863943099976, 300000: 24.910309076309204, 384000: 27.393293857574463, 306000: 25.25875186920166, 74000: 18.178436994552612, 118000: 18.738034963607788, 326000: 25.513248205184937, 16000: 24.229766845703125, 100000: 18.65045690536499, 184000: 21.946819067001343, 268000: 25.016039848327637, 352000: 26.593766927719116, 32000: 19.69257092475891, 80000: 18.1582088470459, 210000: 23.101752042770386, 294000: 26.201587915420532, 378000: 28.026932954788208, 10000: 35.133870124816895, 328000: 25.38268494606018, 152000: 20.703857898712158, 236000: 23.15003490447998, 320000: 26.903038024902344, 52000: 17.945120096206665, 158000: 21.7328097820282, 346000: 27.81009006500244, 204000: 22.602012157440186, 288000: 25.96410322189331, 372000: 26.54750895500183, 94000: 18.384406089782715, 62000: 17.798189878463745, 230000: 23.803049087524414, 314000: 25.945528984069824, 398000: 31.331424951553345, 136000: 20.294739961624146, 12000: 29.46535611152649, 390000: 28.27534294128418, 256000: 23.423882007598877, 340000: 26.164860010147095, 30000: 19.05753993988037, 114000: 18.444633960723877, 198000: 22.629400968551636, 282000: 27.08322286605835, 366000: 26.25536298751831, 56000: 18.29160785675049, 140000: 19.92656898498535, 224000: 22.850502014160156, 308000: 23.833784818649292, 156000: 20.194499969482422, 26000: 20.65705919265747, 334000: 26.9377019405365, 82000: 17.6350519657135, 166000: 20.51869297027588, 250000: 23.511891841888428, 6000: 47.243499994277954, 134000: 19.547131061553955, 108000: 18.50036311149597, 192000: 22.199665069580078, 276000: 23.415847063064575, 360000: 25.325054168701172, 220000: 23.686289072036743, 112000: 20.235549926757812, 8000: 38.574995040893555, 218000: 23.526850938796997, 302000: 24.821906089782715, 386000: 27.483470916748047, 244000: 23.418279886245728, 154000: 19.530729055404663, 392000: 27.060252904891968, 186000: 21.261362075805664, 270000: 24.669883012771606, 354000: 26.7850399017334, 242000: 25.22299098968506, 68000: 18.503583908081055, 150000: 20.72471785545349, 44000: 18.392594814300537, 212000: 24.054256916046143, 296000: 24.633254051208496, 380000: 27.02082896232605, 174000: 23.013771057128906, 50000: 19.02516198158264, 238000: 23.538522958755493, 322000: 27.16215419769287, 96000: 19.099744081497192, 180000: 21.807392835617065, 24000: 20.830286979675293, 4000: 66.1182930469513, 264000: 24.684216022491455, 148000: 20.31847596168518, 38000: 18.32979702949524, 122000: 18.961071014404297, 206000: 22.918817043304443, 290000: 25.207573890686035, 374000: 27.75454020500183, 130000: 19.24707293510437, 64000: 17.657036066055298, 72000: 18.329849004745483, 232000: 23.65850591659546, 316000: 25.28797197341919, 172000: 21.122595071792603, 146000: 20.70047688484192, 90000: 18.199474096298218, 258000: 22.82648491859436, 342000: 25.76897096633911, 370000: 25.486793994903564, 116000: 19.173809051513672, 86000: 18.373577117919922, 284000: 25.446794986724854, 368000: 27.945759057998657, 142000: 20.29368782043457, 226000: 23.519004821777344, 310000: 26.641079902648926, 394000: 28.363338947296143}.items())), 'graphs/multi_putnum2650_costTime.png', plot_type='bx-', use_log=[False, False], log_base=[2, 10], title='2650 reviews with different queue put num', xlabel='Queue Put Number', ylabel='Cost Time')
line1 = {64000: 15.54409909248352, 96000: 17.91155195236206, 197000: 26.181999921798706, 85000: 16.523008823394775, 139000: 20.282007932662964, 42000: 15.590786933898926, 7000: 25.87469482421875, 110000: 19.2220721244812, 194000: 22.00397300720215, 63000: 15.900903940200806, 165000: 25.39664888381958, 20000: 16.67783212661743, 14000: 18.02102303504944, 107000: 18.48328399658203, 191000: 22.506100177764893, 41000: 15.104591846466064, 162000: 21.99971079826355, 134000: 20.51047992706299, 156000: 20.815571069717407, 62000: 16.763310194015503, 21000: 16.343470096588135, 133000: 22.55448079109192, 19000: 16.81163787841797, 188000: 21.900794982910156, 167000: 21.145938873291016, 159000: 20.977035999298096, 40000: 14.630563974380493, 92000: 16.36197590827942, 130000: 20.004963874816895, 61000: 16.08869504928589, 101000: 18.162627935409546, 185000: 23.02169394493103, 178000: 22.194555044174194, 82000: 17.37111496925354, 3000: 46.49158215522766, 127000: 18.712833166122437, 39000: 15.054373979568481, 98000: 17.152311086654663, 182000: 23.054797887802124, 60000: 15.328022956848145, 74000: 16.177387952804565, 153000: 22.400089025497437, 81000: 17.11673903465271, 124000: 19.27326798439026, 179000: 25.213248014450073, 38000: 15.214221000671387, 17000: 16.572164058685303, 113000: 19.675176858901978, 150000: 21.214121103286743, 59000: 14.808340072631836, 121000: 18.029592990875244, 16000: 17.290897130966187, 88000: 17.4464430809021, 176000: 21.587119102478027, 147000: 23.04778790473938, 37000: 15.013219118118286, 118000: 20.59904718399048, 58000: 16.208750009536743, 95000: 18.134380102157593, 135000: 18.583555936813354, 15000: 17.260880947113037, 144000: 20.398552894592285, 115000: 19.906339168548584, 36000: 14.887594938278198, 6000: 28.268728017807007, 170000: 24.483439922332764, 146000: 21.44957709312439, 57000: 15.20581316947937, 141000: 22.118729829788208, 78000: 17.698693990707397, 13000: 18.739008903503418, 112000: 17.59039807319641, 196000: 23.730618953704834, 35000: 15.820635795593262, 157000: 21.67442798614502, 138000: 18.973037004470825, 56000: 15.021862983703613, 84000: 16.99814510345459, 109000: 17.84048080444336, 193000: 23.256552934646606, 77000: 17.247486114501953, 164000: 20.78304386138916, 168000: 24.25407886505127, 34000: 15.409257173538208, 91000: 19.9299099445343, 106000: 16.955354928970337, 190000: 22.159852981567383, 55000: 15.759994983673096, 161000: 20.38531994819641, 76000: 16.719117879867554, 2000: 65.01260614395142, 132000: 19.13209581375122, 33000: 15.048703908920288, 187000: 21.90873908996582, 103000: 18.39875102043152, 158000: 22.461010217666626, 54000: 21.332144021987915, 73000: 16.02231478691101, 129000: 20.15620493888855, 11000: 19.663283824920654, 100000: 17.238421201705933, 184000: 21.836221933364868, 32000: 17.303630828857422, 80000: 15.651803016662598, 114000: 20.26866316795349, 126000: 18.92274308204651, 53000: 15.252794981002808, 97000: 19.4066379070282, 181000: 21.970340967178345, 10000: 20.64423894882202, 87000: 18.07679796218872, 125000: 18.553523063659668, 152000: 21.5577449798584, 31000: 15.385058879852295, 123000: 18.111117124557495, 52000: 15.728004932403564, 94000: 17.578251123428345, 136000: 21.294640064239502, 149000: 22.911736965179443, 9000: 21.874018907546997, 120000: 19.726557970046997, 30000: 14.830615043640137, 5000: 32.38316893577576, 175000: 21.13709783554077, 51000: 15.181730031967163, 117000: 18.790503978729248, 8000: 23.958948135375977, 12000: 19.107399940490723, 172000: 21.16641616821289, 29000: 14.955428838729858, 143000: 22.261148929595947, 199000: 28.121949911117554, 50000: 15.3282949924469, 83000: 16.479693174362183, 169000: 22.211363077163696, 71000: 15.53238320350647, 140000: 19.07860517501831, 28000: 15.321637868881226, 90000: 18.23764705657959, 111000: 17.663609981536865, 195000: 24.501304149627686, 49000: 15.28238320350647, 166000: 20.94898509979248, 137000: 18.93939709663391, 70000: 16.477746963500977, 65000: 16.711618900299072, 108000: 18.976934909820557, 192000: 22.5560519695282, 27000: 15.735305070877075, 163000: 20.5540771484375, 104000: 17.18948006629944, 48000: 15.713478088378906, 72000: 16.87546396255493, 105000: 17.55184507369995, 69000: 16.675304889678955, 173000: 22.406929969787598, 160000: 20.05379891395569, 26000: 15.615864038467407, 79000: 16.12786316871643, 131000: 19.62421417236328, 47000: 15.69202208518982, 102000: 17.823256015777588, 186000: 21.812764167785645, 155000: 22.949939966201782, 68000: 15.950672149658203, 86000: 18.921672105789185, 198000: 25.118178129196167, 128000: 18.385443925857544, 25000: 15.364504098892212, 99000: 19.348181009292603, 183000: 22.045759916305542, 46000: 16.214648962020874, 93000: 17.016628980636597, 154000: 22.229641914367676, 67000: 17.183949947357178, 180000: 22.492046117782593, 24000: 16.141730070114136, 4000: 37.83291292190552, 177000: 22.111371994018555, 151000: 20.441914081573486, 45000: 15.322413921356201, 122000: 21.547066926956177, 66000: 16.261982917785645, 75000: 17.169163942337036, 148000: 21.784814834594727, 23000: 15.78530216217041, 119000: 18.68993091583252, 44000: 15.656283855438232, 18000: 16.511091947555542, 174000: 22.469401121139526, 1000: 82.98990416526794, 145000: 19.383219003677368, 189000: 24.13125205039978, 116000: 20.375128030776978, 22000: 15.855690002441406, 89000: 16.816063165664673, 171000: 23.890240907669067, 43000: 15.311058044433594, 142000: 19.957084894180298}
line2 = {128000: 19.81463313102722, 160000: 21.081717014312744, 168000: 22.348346948623657, 252000: 25.082547187805176, 336000: 25.468505859375, 42000: 18.817505836486816, 110000: 19.18031096458435, 194000: 23.153693914413452, 278000: 24.476943969726562, 362000: 26.582540035247803, 348000: 27.09394884109497, 84000: 19.187562942504883, 46000: 19.493875980377197, 304000: 25.375380039215088, 388000: 27.857498168945312, 162000: 20.100162982940674, 246000: 23.22539496421814, 330000: 23.45575499534607, 126000: 19.270339012145996, 188000: 22.411683082580566, 272000: 26.388715028762817, 356000: 26.414397954940796, 104000: 19.076249837875366, 124000: 18.93190097808838, 214000: 23.257671117782593, 298000: 25.30849599838257, 382000: 27.954083919525146, 200000: 23.260756969451904, 178000: 21.529160022735596, 18000: 23.825605869293213, 240000: 21.976758003234863, 324000: 23.952816009521484, 14000: 26.414932012557983, 182000: 21.530462980270386, 266000: 27.960168838500977, 350000: 26.855690002441406, 60000: 18.247766971588135, 106000: 18.778358936309814, 40000: 19.235347986221313, 208000: 22.615700006484985, 292000: 26.093460083007812, 376000: 28.443765878677368, 102000: 17.9149010181427, 66000: 18.542129039764404, 234000: 24.94533681869507, 318000: 26.6406729221344, 144000: 20.533079862594604, 88000: 18.56637215614319, 176000: 22.0626540184021, 260000: 24.548346996307373, 344000: 26.21404480934143, 202000: 24.00723886489868, 286000: 24.678972005844116, 58000: 18.573670148849487, 228000: 24.19322109222412, 312000: 25.166810035705566, 396000: 25.519543170928955, 36000: 19.090945959091187, 70000: 17.797744035720825, 262000: 23.397679090499878, 170000: 21.464282989501953, 254000: 23.688794136047363, 338000: 26.67580795288086, 78000: 18.830219984054565, 28000: 19.601558923721313, 196000: 23.20405912399292, 280000: 24.916033029556274, 364000: 26.41873788833618, 54000: 18.306936979293823, 138000: 20.2208571434021, 222000: 36.27754592895508, 120000: 20.04131317138672, 20000: 22.305625915527344, 164000: 21.41818904876709, 248000: 24.528424978256226, 332000: 25.985937118530273, 98000: 18.71520495414734, 22000: 21.74246096611023, 190000: 22.090204000473022, 274000: 24.676424026489258, 358000: 25.028383016586304, 92000: 18.349332094192505, 76000: 17.97584104537964, 34000: 18.59342098236084, 48000: 18.69089698791504, 132000: 18.945136070251465, 216000: 22.840863943099976, 300000: 24.910309076309204, 384000: 27.393293857574463, 306000: 25.25875186920166, 74000: 18.178436994552612, 118000: 18.738034963607788, 326000: 25.513248205184937, 16000: 24.229766845703125, 100000: 18.65045690536499, 184000: 21.946819067001343, 268000: 25.016039848327637, 352000: 26.593766927719116, 32000: 19.69257092475891, 80000: 18.1582088470459, 210000: 23.101752042770386, 294000: 26.201587915420532, 378000: 28.026932954788208, 10000: 35.133870124816895, 328000: 25.38268494606018, 152000: 20.703857898712158, 236000: 23.15003490447998, 320000: 26.903038024902344, 52000: 17.945120096206665, 158000: 21.7328097820282, 346000: 27.81009006500244, 204000: 22.602012157440186, 288000: 25.96410322189331, 372000: 26.54750895500183, 94000: 18.384406089782715, 62000: 17.798189878463745, 230000: 23.803049087524414, 314000: 25.945528984069824, 398000: 31.331424951553345, 136000: 20.294739961624146, 12000: 29.46535611152649, 390000: 28.27534294128418, 256000: 23.423882007598877, 340000: 26.164860010147095, 30000: 19.05753993988037, 114000: 18.444633960723877, 198000: 22.629400968551636, 282000: 27.08322286605835, 366000: 26.25536298751831, 56000: 18.29160785675049, 140000: 19.92656898498535, 224000: 22.850502014160156, 308000: 23.833784818649292, 156000: 20.194499969482422, 26000: 20.65705919265747, 334000: 26.9377019405365, 82000: 17.6350519657135, 166000: 20.51869297027588, 250000: 23.511891841888428, 6000: 47.243499994277954, 134000: 19.547131061553955, 108000: 18.50036311149597, 192000: 22.199665069580078, 276000: 23.415847063064575, 360000: 25.325054168701172, 220000: 23.686289072036743, 112000: 20.235549926757812, 8000: 38.574995040893555, 218000: 23.526850938796997, 302000: 24.821906089782715, 386000: 27.483470916748047, 244000: 23.418279886245728, 154000: 19.530729055404663, 392000: 27.060252904891968, 186000: 21.261362075805664, 270000: 24.669883012771606, 354000: 26.7850399017334, 242000: 25.22299098968506, 68000: 18.503583908081055, 150000: 20.72471785545349, 44000: 18.392594814300537, 212000: 24.054256916046143, 296000: 24.633254051208496, 380000: 27.02082896232605, 174000: 23.013771057128906, 50000: 19.02516198158264, 238000: 23.538522958755493, 322000: 27.16215419769287, 96000: 19.099744081497192, 180000: 21.807392835617065, 24000: 20.830286979675293, 4000: 66.1182930469513, 264000: 24.684216022491455, 148000: 20.31847596168518, 38000: 18.32979702949524, 122000: 18.961071014404297, 206000: 22.918817043304443, 290000: 25.207573890686035, 374000: 27.75454020500183, 130000: 19.24707293510437, 64000: 17.657036066055298, 72000: 18.329849004745483, 232000: 23.65850591659546, 316000: 25.28797197341919, 172000: 21.122595071792603, 146000: 20.70047688484192, 90000: 18.199474096298218, 258000: 22.82648491859436, 342000: 25.76897096633911, 370000: 25.486793994903564, 116000: 19.173809051513672, 86000: 18.373577117919922, 284000: 25.446794986724854, 368000: 27.945759057998657, 142000: 20.29368782043457, 226000: 23.519004821777344, 310000: 26.641079902648926, 394000: 28.363338947296143}
plot.draw_two_lines(line1, line2, '2000', '2650', xlabel='Put Number', ylabel='Cost Time', filename='put_num_cost_time')
# single_dict = {3200: 262.5096769332886, 1600: 85.40117812156677, 4100: 393.40612506866455, 1800: 106.48868107795715, 2700: 205.33925104141235, 3600: 316.5888249874115, 1300: 57.37373399734497, 2200: 147.6752598285675, 3100: 251.0879030227661, 4000: 376.5115270614624, 1200: 47.4332001209259, 1700: 95.24941492080688, 2600: 193.1543800830841, 1500: 76.3985378742218, 3500: 303.85127091407776, 4400: 442.0929400920868, 2100: 137.83491921424866, 3000: 238.65617418289185, 3900: 362.72043108940125, 4800: 512.3878018856049, 2500: 182.00989508628845, 3400: 289.6758699417114, 1100: 39.687593936920166, 4300: 426.81977820396423, 2000: 128.8628499507904, 1400: 67.05243587493896, 2900: 227.98532700538635, 3800: 346.6359498500824, 4900: 532.5565299987793, 4700: 494.07091212272644, 2400: 171.3094789981842, 3300: 276.6393790245056, 1000: 32.356853008270264, 1900: 118.46214699745178, 2800: 216.5012538433075, 4200: 410.1247251033783, 3700: 333.5055329799652, 4600: 477.0842230319977, 4500: 461.1914498806, 2300: 159.1701009273529}
# single_dict = collections.OrderedDict(sorted(single_dict.items()))
# # -------------------------
# multi_dict = {3200: 54.066938161849976, 4800: 128.33483600616455, 4100: 90.9959008693695, 1800: 19.561939001083374, 2700: 39.220300912857056, 3600: 68.17520594596863, 1300: 10.319740056991577, 2200: 25.881090879440308, 3100: 51.64960503578186, 4000: 85.37146997451782, 4400: 104.64823603630066, 1700: 15.290241956710815, 2600: 36.57039403915405, 4700: 121.93518900871277, 3500: 63.91759896278381, 1200: 7.749666929244995, 2100: 24.729274034500122, 3000: 46.17844796180725, 3900: 80.35389804840088, 1600: 13.229113101959229, 2500: 33.319267988204956, 3400: 60.7636878490448, 4300: 100.47692394256592, 1100: 6.378443956375122, 2000: 21.803447008132935, 4600: 116.3408420085907, 2900: 44.40487289428711, 3800: 76.09995889663696, 4900: 134.72134685516357, 1500: 12.677587032318115, 2400: 30.849808931350708, 3300: 55.22924494743347, 1000: 5.362555980682373, 1900: 19.344277143478394, 2800: 41.42467212677002, 4200: 94.54766416549683, 3700: 72.58612585067749, 1400: 12.157100915908813, 4500: 110.68796515464783, 2300: 27.833203077316284}
# multi_dict = collections.OrderedDict(sorted(multi_dict.items()))
# single_x_list = single_dict.keys()
# single_y_list = single_dict.values()
# multi_x_list = multi_dict.keys()
# multi_y_list = multi_dict.values()
# plt.ylabel('Cost Time')
# plt.xlabel('Total Data Num')
# line_single, line_multi = plt.plot(single_x_list, single_y_list, 'bx-', multi_x_list, multi_y_list, 'ro-')
# plt.legend([line_single, line_multi], ['Single', 'Multi'], bbox_to_anchor=(0.5, 1))
# plt.savefig('graphs/single_multi_1000_5000_100.png')