-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path折线图_双轴.py
319 lines (297 loc) · 27.7 KB
/
折线图_双轴.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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
# import pickle
# with open("D:\\VASRL\\server\\server\\my_dds_sr_619\\DRL_con\\f1_time.txt", "rb") as get_myprofile:
# result = pickle.load(get_myprofile)
# f1=result[0]
# time=result[1]
# d_time=[[0, 18], [38], [61, 84], [104], [129, 143], [150], [], [232], [], [270], [300], [330, 344, 355], [], [390], [420, 438, 448], [450, 467], [482, 500], [517, 533], [548, 563], [577, 590], [600, 627], [], [660, 668, 677, 687], [699, 712], [725, 736], [750, 774], [795], [810, 820, 831], [841, 851, 864], [879, 895], [900, 916, 928], [941, 955], [971, 988], [1002], [1020, 1037], [1050, 1055, 1060, 1065, 1070, 1075], [1080, 1085, 1089, 1093, 1097, 1100, 1104, 1108], [1112, 1115, 1119, 1123, 1128, 1133, 1138], [1143, 1148, 1153, 1158, 1163, 1168], [1173, 1178, 1183, 1188, 1193, 1198], [1203, 1208, 1213, 1218, 1223, 1228], [1233, 1238, 1243, 1248, 1253, 1258], [1263, 1268, 1273, 1278, 1283, 1288], [1293, 1298, 1303, 1308, 1313, 1318], [1323, 1328, 1332, 1337, 1342, 1347], [1350, 1361, 1374], [1389, 1404], [1422, 1438], [1454, 1467], [1480, 1494], [1505, 1516], [1530, 1542, 1553], [1568, 1581], [1594, 1608], [1622, 1637], [1650, 1661, 1675], [1680], [1710, 1727], [1742, 1756, 1768], [1785], [1800, 1815, 1827], [1839, 1851], [1863, 1877], [1890, 1900, 1910], [1920, 1931, 1941], [1951, 1960, 1969], [1985, 2000], [2012, 2021, 2030], [2040, 2050, 2060], [2070, 2077, 2084, 2092], [2100, 2108, 2116, 2123], [2133, 2144, 2158], [2171, 2185], [2194, 2203, 2211, 2218], [2228, 2238], [2250, 2261, 2273], [2280, 2291, 2301], [2311, 2322, 2332], [2342, 2352, 2365], [2378, 2390], [2403, 2421], [2430, 2439, 2452], [2475], [2494, 2511], [2525, 2534, 2546], [2557, 2567, 2578], [2593], [2613, 2628], [2644, 2658, 2666], [2670, 2676, 2683, 2692], [2700, 2712, 2724], [2737, 2749, 2758], [2769, 2779], [2790, 2800, 2811], [], [], [2880], [2922]]
# d_time=[len(i) for i in d_time]
# print(sum(d_time))
# time=[1/(i/30+j*0.021/30+0.005+(30-j)*0.01/30) for i,j in zip(time,d_time)]
# data=[ [a,b] for a,b in zip(f1,time)]
# print(data)
# f=open('low_query_time.txt')
# txt=[]
# for line in f:
# txt.append(float(line.replace('\n','')))
# txt=txt[210:]
# f=open('high_query_time.txt')
# txt1=[]
# for line in f:
# txt1.append(float(line.replace('\n','')))
# txt1=txt1[210:]
# time=[1/((a+b)/30) for a,b in zip(txt,txt1)]
# #print(time)
# #[1.5299364130245858, 2.792273007787041, 2.6276195041689294, 2.6502938596792385, 2.748461823711862, 3.726005252629246, 3.726580066338505, 3.740004750311845, 3.8632970915276226, 3.764515535504061, 2.9754687755792966, 3.0196534667234527, 3.0486958611320105, 3.0723916249187915, 2.978232290441384, 2.6954824892773863, 2.6866465345764516, 2.545511939552054, 2.5518379293540945, 2.447077994772905, 3.18141689613457, 3.140789422711728, 3.122383034882248, 3.1000718468786865, 3.033194365793023, 2.5077409580139687, 2.6396966922604843, 2.7475280699413784, 2.48176991845821, 2.5491671804676717, 2.656660398497624, 2.5459332938150787, 2.628561979159116, 2.548348739275489, 2.5795297355048192, 3.1758620078685604, 3.0349755215199195, 2.9599747825227825, 3.210217251817448, 3.1032147339485876, 3.0459050119297775, 3.186207733739649, 3.078205183686812, 2.949745299913811, 2.879746084400197, 2.241098823264389, 2.2488633179106783, 2.374665727085344, 2.3073844925293803, 2.2359263727378766, 2.166461993718542, 2.2151062997039186, 2.355783894304825, 2.3880543535068623, 2.3140397319888133, 2.380779634627332, 2.2498067902551058, 2.2298020704113086, 2.268577349923986, 2.146530464833459, 2.0086335931384354, 2.064662877886159, 2.1023161644649946, 2.0207895944876624, 1.9603766211604654, 1.9777912436252212, 2.0390655806029074, 2.0539396766283358, 2.0210781469633967, 1.973952430723794, 2.24471203655729, 2.750722526056682, 2.727711172668642, 2.7092862938975864, 2.79598308879476, 2.7128195168797498, 3.1173387853491734, 3.1206714269618523, 3.2095057742302613, 3.102112377524811, 3.0768963667500278, 3.0835372171062105, 2.9667944694490065, 2.970096188310561, 2.805018278111114, 2.9673703476717384, 2.930214530556462, 2.9653074977981557, 3.18270715836392, 3.224412946071361, 2.704393728092468, 2.668913068801891, 2.6619383417317657, 2.775884487629976, 2.7656185515200664, 2.631948437964387, 2.6910855750024782, 2.8385784160910417, 2.794859457211531, 2.758546363271944]
# data=[ [a,b] for a,b in zip(f1,time)]
# print(data)
import os
import matplotlib.pyplot as plt
import numpy as np
# accup=[]
# a=[[0.656, 1.2911693668365478], [0.657, 0.3023633766174316], [0.774, 0.552512845993042], [0.778, 0.27478216171264647], [0.697, 0.5605373001098632], [0.816, 0.2821085262298584], [0.769, 0], [0.782, 0.2744538593292236], [0.867, 0], [0.732, 0.28321788787841795], [0.784, 0.2846629428863525], [0.806, 0.8579897308349609], [0.668, 0], [0.781, 0.28283880233764647], [0.843, 0.8441094779968261], [0.738, 0.559191665649414], [0.755, 0.3441746234893799], [0.803, 0.6062199687957763], [0.85, 0.565069637298584], [0.854, 0.5506679630279541], [0.686, 0.5642757034301757], [0.567, 0], [0.5, 0.6985065937042236], [0.657, 0.556487283706665], [0.613, 0.5531546688079834], [0.748, 0.5616774177551269], [0.62, 0.27620361328125], [0.719, 0.856921854019165], [0.671, 0.8433546447753906], [0.702, 0.5534882164001464], [0.855, 0.8438305282592773], [0.785, 0.5507971858978271], [0.847, 0.5552608585357666], [0.81, 0.2836556243896484], [0.853, 0.5704950904846191], [0.964, 0.8311300659179688], [0.886, 0.9412463474273682], [0.914, 0.6893988609313966], [0.885, 0.6114562320709228], [0.911, 0.5966270732879639], [0.913, 0.8349552536010743], [0.931, 0.604080514907837], [0.952, 0.6288185882568359], [0.955, 0.5993254947662354], [0.962, 0.818249740600586], [0.864, 0.8768724822998046], [0.839, 0.5765850162506103], [0.893, 0.5600623703002929], [0.873, 0.5530929183959961], [0.894, 0.5574371433258056], [0.893, 0.5521089649200439], [0.902, 0.8321921253204345], [0.871, 0.5543577289581298], [0.92, 0.5628831005096435], [0.872, 0.5523583507537841], [0.896, 0.8332700157165527], [0.82, 0.31277463912963865], [0.771, 0.557379446029663], [0.776, 0.55525728225708], [0.781, 0.5778224086761474], [0.819, 0.5557999229431152], [0.806, 0.5710157966613769], [0.79, 0.8330463790893554], [0.851, 0.8265785598754882], [0.787, 0.5536517715454101], [0.856, 0.8392524147033691], [0.854, 0.5535878753662109], [0.853, 0.8347913646697998], [0.871, 0.8414921188354492], [0.866, 0.9115292644500732], [0.823, 0.7192947864532471], [0.738, 0.852076711654663], [0.675, 0.5513033485412597], [0.676, 0.683955192565918], [0.781, 0.3389909267425537], [0.775, 0.6343455123901367], [0.801, 0.840972843170166], [0.875, 0.8342759037017822], [0.788, 0.8278858089447021], [0.755, 0.5481052017211914], [0.871, 0.5496084308624267], [0.863, 0.6221656608581543], [0.851, 0.27779767990112303], [0.877, 0.5491656875610351], [0.891, 0.8242613697052001], [0.947, 0.8265947723388671], [0.904, 0.2763557243347168], [0.84, 0.5497974967956543], [0.873, 0.8284816169738769], [0.891, 0.6844782829284668], [0.767, 0.6260816860198974], [0.801, 0.8295449638366699], [0.776, 0.5472426033020019], [0.847, 0.8329948806762695], [0.868, 0], [0.833, 0], [0.687, 0.2839255142211914], [0.726, 0.2798955249786377]]
# b=[[0.588, 2.791468935012818], [0.616, 2.0352531242370606], [0.685, 2.0463991928100587], [0.601, 1.9920461940765384], [0.559, 1.988676624298096], [0.588, 1.9196301269531253], [0.533, 1.9556110668182376], [0.534, 1.9579568672180179], [0.554, 2.5408263969421387], [0.484, 1.9976104068756106], [0.62, 1.9542444515228274], [0.673, 1.995927886962891], [0.635, 1.9281073379516604], [0.642, 1.9498296546936038], [0.599, 2.0323766040802003], [0.737, 1.9820459651947024], [0.75, 2.0071533489227296], [0.771, 2.0139733123779298], [0.83, 1.9675763416290286], [0.835, 1.9900317955017093], [0.381, 1.9817174243927005], [0.447, 2.986247615814209], [0.419, 1.9605501461029056], [0.544, 2.003684597015381], [0.539, 2.016058282852173], [0.6, 1.9673198032379153], [0.512, 1.9885817337036136], [0.588, 2.037185506820679], [0.557, 2.03306658744812], [0.637, 2.0074017810821534], [0.836, 2.0060551929473878], [0.82, 1.9930952358245853], [0.859, 1.9621880817413333], [0.869, 2.2584038543701173], [0.864, 2.0889523792266846], [0.967, 1.956943111419678], [0.906, 1.967926816940308], [0.922, 1.9377980995178226], [0.917, 1.986106233596802], [0.929, 1.8964129257202151], [0.946, 1.958285646438599], [0.95, 1.9347058105468753], [0.957, 2.0424733924865723], [0.951, 1.9501498508453372], [0.969, 1.9517930316925052], [0.794, 2.016619758605957], [0.783, 2.4625311660766602], [0.795, 2.0579081344604493], [0.834, 2.040665225982666], [0.808, 1.9854901599884036], [0.865, 1.990829067230225], [0.89, 2.004384355545044], [0.807, 2.0077052879333497], [0.873, 1.959215240478516], [0.851, 1.9638551044464114], [0.859, 1.9618194866180423], [0.741, 2.034618215560913], [0.724, 1.9377954769134524], [0.728, 2.106045083999634], [0.702, 2.176071481704712], [0.776, 2.014274673461914], [0.776, 1.992134408950806], [0.779, 1.9992085266113284], [0.776, 1.9801710414886478], [0.757, 1.9559610652923587], [0.782, 1.9882126617431644], [0.786, 2.008215742111206], [0.776, 1.9575880336761478], [0.828, 1.961276369094849], [0.863, 2.026636438369751], [0.844, 2.1218171882629395], [0.628, 2.0944362449645997], [0.536, 1.9764960575103763], [0.662, 1.9683180618286136], [0.742, 1.9985426235198978], [0.708, 1.9715271759033206], [0.822, 1.9638407993316653], [0.85, 1.983732776641846], [0.801, 2.0054260063171387], [0.724, 1.9730201530456546], [0.833, 1.9771052169799808], [0.891, 1.9385371971130374], [0.804, 2.026713447570801], [0.895, 1.9745975303649905], [0.867, 1.9999864864349368], [0.941, 1.9445837306976321], [0.844, 2.0029178428649903], [0.787, 1.950283365249634], [0.838, 1.949391202926636], [0.828, 1.9512189197540286], [0.686, 1.9981725978851321], [0.72, 1.9547549057006839], [0.784, 2.021676378250122], [0.744, 1.996404485702515], [0.707, 2.8589692878723145], [0.645, 2.027593688964844], [0.728, 2.0090499687194825], [0.703, 1.973924951553345]]
# for i,j in zip(a,b):
# accup.append(i[0]/j[0])
# print(accup)
###fig9
import matplotlib.pyplot as plt
if __name__ == '__main__':
false_size = [21714.22705, 21714.22705, 21724.58129, 22510.49334, 24003.31465, 25449.52348, 26983.19201, 28295.20112, 29557.75999, 30848.77680, 32080.08409, 33302.18676, 34434.20357, 35549.53118, 36464.01577, 37528.23896, 38538.00841, 39484.42151, 40397.95340, 41184.56167, 42021.02803, 42920.16118, 43746.82691, 44536.59566, 45445.45270, 46164.26314, 46918.71058, 47757.76594, 48642.35249, 49325.32726, 50015.90470, 50725.04870, 51521.44289, 52447.71374, 52912.14926, 53807.96566, 54511.17589, 54912.33427, 55789.19376, 56354.71338, 56638.53644, 57605.66503, 58081.93728, 58532.39348, 59365.12579, 59787.18325, 60564.91100, 60862.55851, 61526.15943, 62406.41906, 62551.02137, 62699.65487, 63680.95165, 64410.18535, 64760.08234, 65258.16819, 65919.09601, 66693.85424, 67599.23651, 68052.90715, 68659.28732, 69709.31395, 70293.73931, 71275.90049, 71818.62474, 72926.64541, 73761.38157, 74528.26559, 75821.70568, 76773.03048, 77984.77260, 79269.16783, 80071.48318, 81672.63315, 83548.09706, 83873.67449, 85291.26349, 87485.08269, 89541.85704, 90699.42116, 92831.66363, 95203.01717, 97206.07568, 100436.46636, 102636.69516, 105235.95200, 109042.95410, 111599.49334, 116401.57043, 119959.24422, 126470.10371, 131360.25788, 136543.46286, 146842.97828, 159293.30484, 173210.85179, 190888.13174, 211367.27575, 234308.44604, 282633.64436, 319963.96111]
false_size=[i/(1024) for i in false_size]
false_time = [1.43130, 1.38006, 1.51323, 1.45868, 1.51055, 1.36469, 1.34773, 1.41773, 1.38622, 1.36869, 1.43696,
1.41124, 1.39557, 1.37889, 1.39315, 1.44551, 1.43552, 1.44993, 1.39343, 1.37357, 1.37221, 1.41257,
1.39824, 1.35907, 1.38076, 1.37658, 1.34424, 1.32803, 1.37385, 1.36157, 1.45419, 1.38630, 1.34599,
1.37501, 1.51610, 1.43208, 1.50840, 1.42141, 1.39749, 1.39802, 1.42326, 1.40436, 1.41719, 1.38632,
1.45213, 1.40128, 1.36227, 1.50074, 1.37852, 1.42588, 1.39351, 1.37597, 1.38446, 1.38429, 1.42563,
1.37193, 1.44029, 1.50645, 1.40649, 1.37338, 1.47141, 1.44049, 1.40393, 1.37843, 1.36302, 1.38990,
1.40422, 1.34308, 1.38735, 1.39289, 1.59113, 1.47558, 1.40386, 1.35363, 1.43550, 1.38801, 1.42793,
1.31047, 1.35873, 1.37483, 1.36795, 1.35819, 1.36229, 1.44067, 1.39491, 1.48112, 1.38576, 1.45005,
1.37623, 1.36256, 1.33680, 1.33840, 1.37793, 1.33805, 1.39057, 1.36961, 1.51845, 1.41667, 1.37394,
1.37652, 1.40081]
true_size = [12190.56342,12190.56342,12202.25473,13167.05886,14992.31780,16787.20743,18618.07113,20213.38963,21741.19131,23222.06938,24617.60477,25966.51086,27207.83987,28471.54555,29517.75438,30665.28171,31754.38017,32808.77715,33845.09110,34683.16994,35626.17029,36603.98844,37518.21619,38353.50666,39313.33497,40067.50981,40875.86931,41680.49509,42621.42116,43280.40434,44024.16118,44763.92537,45558.56797,46475.01717,46966.28942,47862.97617,48594.91135,49015.14331,49967.95445,50576.75718,50878.72285,51909.73090,52431.70988,52896.45095,53747.34828,54197.78346,55049.01927,55343.75753,56006.07884,56917.91906,57072.69657,57225.81289,58340.15032,59066.73896,59426.37526,59913.17204,60556.35284,61378.00350,62331.10792,62791.73686,63417.19797,64454.29502,65042.87596,66026.43938,66595.45235,67698.28381,68531.41345,69303.48318,70541.47722,71501.68220,72716.16153,74025.07323,74815.13770,76383.82025,78223.42081,78560.38507,79997.49089,82243.76804,84247.61247,85415.49685,87512.46496,89893.88683,91883.64331,94973.27050,97152.97302,99622.44324,103193.20568,105696.12824,110323.47863,113643.60547,119681.81675,124506.95725,129462.84618,138623.42957,149210.57253,161813.34022,177896.23546,197308.83041,219714.32130,266297.69376,302114.06833]
true_size = [i / (1024) for i in true_size]
true_time = [1.39811, 1.38842, 1.39478, 1.37934, 1.42729, 1.38214, 1.43595, 1.37097, 1.41813, 1.48043, 1.57370,
1.43200, 1.55338, 1.40142, 1.40361, 1.39919, 1.44805, 1.42904, 1.41700, 1.54761, 1.46615, 1.34981,
1.45806, 1.44151, 1.38211, 1.38172, 1.41314, 1.39175, 1.39882, 1.39573, 1.40823, 1.38956, 1.38240,
1.40369, 1.43454, 1.51790, 1.49079, 1.40754, 1.38851, 1.48599, 1.40966, 1.38664, 1.40175, 1.43009,
1.35588, 1.39600, 1.37664, 1.42539, 1.42777, 1.49735, 1.42117, 1.41271, 1.38857, 1.37729, 1.38358,
1.41749, 1.38494, 1.39618, 1.38874, 1.50762, 1.42183, 1.40691, 1.51741, 1.38628, 1.37029, 1.52645,
1.37632, 1.39456, 1.37662, 1.38496, 1.41284, 1.43025, 1.38431, 1.41627, 1.39598, 1.49045, 1.43035,
1.38184, 1.39668, 1.45718, 1.40372, 1.41677, 1.39940, 1.40809, 1.60668, 1.48577, 1.40607, 1.38088,
1.45585, 1.42360, 1.39755, 1.42075, 1.42325, 1.48816, 1.39956, 1.45839, 1.45713, 1.40263, 1.45996,
1.44256, 1.43143]
y2=[0.832785759, 0.837688107381295, 0.84259045576259, 0.8474928041438848, 0.8523951525251798, 0.8572975009064748, 0.8621998492877698, 0.8671021976690647, 0.8720045460503597, 0.8769068944316547, 0.8818092428129497, 0.8867115911942446, 0.8884146642805756, 0.8896814725539568, 0.8909482808273381, 0.8922150891007194, 0.8934818973741008, 0.894748705647482, 0.8960155139208633, 0.8972823221942446, 0.898549130467626, 0.8998159387410072, 0.9010827470143885, 0.9022758533992806, 0.9034456855035972, 0.9046155176079137, 0.9057853497122302, 0.9069551818165468, 0.9081250139208633, 0.9092948460251798, 0.9104646781294964, 0.9116345102338129, 0.9128043423381295, 0.913974174442446, 0.9149162858561151, 0.915730304381295, 0.9165443229064748, 0.9173583414316546, 0.9181723599568345, 0.9189863784820144, 0.9198003970071943, 0.9206144155323741, 0.9214284340575539, 0.9222424525827339, 0.9230564711079137, 0.9237280769244605, 0.9242682248561152, 0.9248083727877698, 0.9253485207194245, 0.9258886686510792, 0.9264288165827339, 0.9269689645143885, 0.9275091124460432, 0.9280492603776979, 0.9285894083093525, 0.9291295562410072, 0.9297105439928058, 0.9303527914748202, 0.9309950389568346, 0.931637286438849, 0.9322795339208634, 0.9329217814028777, 0.9335640288848921, 0.9342062763669066, 0.9348485238489209, 0.9354907713309353, 0.9361330188129496, 0.9368762683129497, 0.9378792372877698, 0.93888220626259, 0.9398851752374101, 0.9408881442122302, 0.9418911131870504, 0.9428940821618705, 0.9438970511366906, 0.9449000201115109, 0.945902989086331, 0.9469059580611511, 0.9479297793093525, 0.9490630749928057, 0.9501963706762591, 0.9513296663597123, 0.9524629620431655, 0.9535962577266187, 0.9547295534100719, 0.9558628490935251, 0.9569961447769785, 0.9581294404604317, 0.9592627361438849, 0.9604160525755395, 0.9620498669640288, 0.963683681352518, 0.9653174957410072, 0.9669513101294964, 0.9685851245179856, 0.9702189389064748, 0.971852753294964, 0.9734865676834532, 0.9751203820719424, 0.9767541964604316]
font1 = {'family': 'Arial',
'weight': 'normal',
'size': 20,
}
font2 = {'family': 'Arial',
'weight': 'normal',
'size': 20,
}
fs=15
fls=20
#plt.style.use('ggplot')
bars_name = ["Reuse","LR", "SR"] # 柱子名称
f1score = [0.73*0.95, 0.72, 0.73]
decode = [0,0.02220, 0.02124]
sr = [0,0, 0.05872]
infer = [0,0.03940, 0.04918]
resuse=[0.01,0,0]
labels = ["f1score", "decode", "SR", "infer","reuse"] # 每个柱子的组成
colors = ["06283D", "moccasin", "royalblue", "orchid"] # 每个组成的颜色
# colors = ["gold", "darkorange", "firebrick", "darkmagenta"]
colors = ["#2D4059", "#EA5455", "#FFD460", "#F07B3F","#E0F9B5"] # 每个组成的颜色
err_attr = {"elinewidth":1,"ecolor":"black", "capsize":6}
other = {
"title": "", # 标题
"xlabel": "Scheme", # 横坐标名称
"ylabel_left": "F1-score", # 纵坐标名称
"ylabel_right": "Size(KB)"
}
# std_err2 = [[0.3,0.3], 0.5*0.25, 0.45*0.25]
# std_err2=[[0.28*0.7,0.15,0.14],[0.25*0.7,0.2,0.21]]
# xticks = np.arange(len(bars_name))*0.7
a1=[8, 5, 3, 2, 14, 2, 2, 0, 2, 8, 2, 0, 1, 1, 1, 1, 0, 1, 0, 1, 4, 8, 14, 1, 1, 5, 9, 6, 6, 6, 1, 0, 1, 0, 0, 2, 5, 2,
0, 3, 0, 1, 2, 0, 2, 5, 9, 4, 8, 6, 14, 6, 6, 9, 5, 6, 4, 12, 14, 3, 6, 10, 8, 4, 5, 7, 4, 5, 7, 7, 2, 8, 8, 4, 1,
14, 2, 1, 10, 2, 3, 0, 3, 1, 4, 1, 2, 2, 2, 4, 1, 4, 8, 7, 6, 11, 7, 10]
a2=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 3, 3, 0, 2, 0, 4, 3, 3,
4, 2, 4, 3, 2, 4, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 4, 4, 0, 0, 2, 4, 0,
4, 3, 0, 0, 0, 3, 0, 3, 0, 3, 0, 0, 3, 0, 4, 0, 0, 0, 0, 0, 0, 0]
fig, ax = plt.subplots(figsize=(7, 2.8))
x=[i*3 for i in range(33)]
plt.fill_betweenx([-0.1, 400], 40, 80, color='#DCD0FF', alpha=0.7)
ax.plot(x,y2[2::3],color='#779DE9',marker='o',markeredgewidth=0.01,label='F1-score',zorder=20)
# bar_width = 0.2
# #, yerr=std_err2,error_kw=err_attr
# lns1 = ax.bar(xticks, f1score, width=bar_width, label=labels[0],yerr=std_err2,error_kw=err_attr,color=colors[0],edgecolor='black')
#
ax2 = ax.twinx()
ax2.plot(x,false_size[3::3],marker='s',color='#F8C1B7',markeredgewidth=0.1,label='Size',zorder=10)
# bot = np.array(len(bars_name))*0.0
# lns2 = ax2.bar(xticks + bar_width, decode, width=bar_width, label=labels[1], color=colors[1], bottom=bot,hatch="",edgecolor='black')
# bot += decode
# lns3 = ax2.bar(xticks + bar_width, sr, width=bar_width, label=labels[2], color=colors[2], bottom=bot, hatch="",edgecolor='black')
# bot += sr
# lns4 = ax2.bar(xticks + bar_width, infer, width=bar_width, label=labels[3], color=colors[3], bottom=bot, hatch="",edgecolor='black')
# bot += infer
# lns5 = ax2.bar(xticks + bar_width, resuse, width=bar_width, label=labels[4], color=colors[4], bottom=bot,hatch="",edgecolor='black')
# bot += resuse
ax.set_ylabel(other["ylabel_left"], fontsize=fls)
ax2.set_ylabel(other["ylabel_right"], fontsize=fls)
# ax.set_yticks(np.arange(0, 1, 0.2))
ax.set_ylim(0.8, 1.05)
ax2.set_ylim(0, 400)
ax.tick_params(labelsize=fs)
ax2.tick_params(labelsize=fs)
plt.axvline(x=40, color='gray', linestyle='--')
plt.axvline(x=80, color='gray', linestyle='--')
ax.axhline(0.92, color='#779DE9', linestyle='--')
# ax.set_yticks([0.80,0.85,0.90,0.95,1.00])
ax.set_yticks([0.80,0.92,1.00])
plt.text(40, 100, '540px2 acc.', fontsize=20, color='black')
#lns = [lns1, lns2, lns3, lns4,lns5]
# labs = [l.get_label() for l in lns]
# #ax2.legend(lns, labs, fontsize=18)
#ax2.legend( fontsize=14.5)
#ax2.set_title(other["title"], fontsize=1200)
# ax2.set_xlabel(other["xlabel"])
#ax2.set_xticks(xticks + bar_width/2)
#ax.set_xticklabels(bars_name,fontsize=20)
# 网格线
ax.set_xlabel('Quality',font2)
# ax.legend(fontsize=14.5,bbox_to_anchor=(0.5, 0.5))
# ax2.legend(fontsize=14.5)
lines = []
labels = []
axLine, axLabel = ax.get_legend_handles_labels()
lines.extend(axLine)
labels.extend(axLabel)
axLine, axLabel = ax2.get_legend_handles_labels()
lines.extend(axLine)
labels.extend(axLabel)
plt.legend(lines, labels,ncol=2,fontsize=fls)
#ax.set_yticks([0.7,0.8,0.9,1.0],[0.05,"0.30",0.55,'0.80'])
#ax2.set_yticks( [0,2,4],[0.5,1.5,2.5])
plt.rcParams['hatch.linewidth'] = 2
ax.grid(axis='y', zorder=1)
plt.tight_layout() # 让图片适应画布大小
plt.savefig("iencode_f1_size.png")
plt.savefig("iencode_f1_size.svg")
plt.savefig("iencode_f1_size.pdf")
plt.show()
# import pickle
# with open("all_reward.txt", "rb") as get_myprofile:
# result = pickle.load(get_myprofile)
# # print(len(result[0]))
# op_thres=[]
# for i in range(98):
# maxrd = -1
# index=-1
# for j in range(75):
# if maxrd<result[j][i]:
# maxrd = result[j][i]
# index=j
# op_thres.append(index)
# d_op=[]
# s_op=[]
# for i in op_thres:
# d_op.append(int(i / 5))
# s_op.append(i%5)
# print(d_op)
# print(s_op)
import pandas as pd
# result=pd.read_csv('glimpse_results_yolo_540.csv')
# f1=result['model'].tolist()
# print(result)
# #time=[1/i for i in time]104.2910341956735
# #print(result)
# time=result['video_name'].tolist()
# f1time=[]
# for i,j in zip(f1,time):
# f1time.append([i,j])
# print(f1time)
# with open("720p.txt", "r") as f:
# data = f.readlines()
# #print(data)
# lenth=0
# for line in data:
# new=line.strip('\n').split(' ')
# lenth+=len(new)-1
# print(lenth/77.6543462886523)
# aws=pd.read_csv('awstream_pro_yolo.csv')
# aws1=pd.read_csv('awstream_res_yolo.csv')
# # aws=aws[aws['resolution']=='540p']
# res=[]
# for i in aws1['best_resolution']:
#
# if i=='360p':
# res.append(2)
# elif i=='480p':
# res.append(1.5)
# elif i=='540p':
# res.append(1.3)
# else:
# res.append(1)
# print(res)
# f1_time=[]
# allf1=[]
# all_fr=0
# for fr,f1 in zip(aws['frame_rate'],aws['f1']):
# if fr<0.54 or fr>0.61 or fr==1:
# continue
# #print(f1)
#
# fr=1/(fr/3*(0.021+0.06)*30)*30
# allf1.append(f1)
# all_fr+=fr
# #f1_time.append([f1,fr])
# i=0
# for fr,f1 in zip(aws['frame_rate'],aws['f1']):
# if fr!=1:
# continue
# allf1[i]=f1/allf1[i]
# i+=1
# for fr,f1 in zip(aws1['frame_rate'],allf1):
# f1_time.append([f1,32/fr])
#
# print(f1_time)
#print(allf1/len(f1_time))
# import matplotlib.pyplot as plt
#
# fig,axes=plt.subplots(3,4)
#
# # 默认样式
# axes[0,0].arrow(0,0,1,1)
# # 设置箭头尾部、头部宽度
# axes[0,1].arrow(0,0,1,1,width=0.2,head_width=0.5)
#
#
# plt.show()
# f=open("C:\\Users\\mi\\Desktop\\low_query_time.txt")
# txt=[]
# for line in f:
# print(line.replace('\n',''))
# txt.append(float(line.replace('\n','')))
#
# txt=txt[310:]
# # print(txt)
# f=open('C:\\Users\\mi\\Desktop\\high_query_time.txt')
# txt1=[]
# for line in f:
# txt1.append(float(line.replace('\n','')))
# txt1=txt1[310:]
# time=[1/((a+b)/30) for a,b in zip(txt,txt1)]
# print(time)
# f=open('C:\\Users\\mi\\Desktop\\infer_time.txt')
# times=[]
# for line in f:
# times.append(float(line.replace('\n','')))
# times=times[9000:]
# # time=[1/((a+b)/30) for a,b in zip(txt,txt1)]
# print(times)
# spdup=[2.0, 1.0, 2.0, 1.0, 2.0, 1.0, 0.0, 1.0, 0.0, 1.0, 1.0, 3.0, 0.0, 1.0, 3.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 0.0, 4.0, 2.0, 2.0, 2.0, 1.0, 3.0, 3.0, 2.0, 3.0, 2.0, 2.0, 1.0, 2.0, 6.0, 8.0, 7.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 3.0, 2.0, 2.0, 2.0, 2.0, 2.0, 3.0, 2.0, 2.0, 2.0, 3.0, 1.0, 2.0, 3.0, 3.0, 2.0, 3.0, 2.0, 3.0, 3.0, 2.0, 2.0, 2.0, 3.0, 4.0, 4.0, 3.0, 2.0, 4.0, 2.0, 3.0, 3.0, 3.0, 3.0, 2.0, 2.0, 3.0, 1.0, 2.0, 3.0, 3.0, 1.0, 2.0, 3.0, 4.0, 3.0, 3.0, 2.0, 3.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0]
# print(sum(spdup)/len(spdup))
# cro=[[0.549, 1.5299364130245858], [0.598, 2.792273007787041], [0.703, 2.6276195041689294], [0.644, 2.6502938596792385], [0.627, 2.748461823711862], [0.623, 3.726005252629246], [0.5, 3.726580066338505], [0.505, 3.740004750311845], [0.498, 3.8632970915276226], [0.402, 3.764515535504061], [0.682, 2.9754687755792966], [0.7, 3.0196534667234527], [0.562, 3.0486958611320105], [0.574, 3.0723916249187915], [0.531, 2.978232290441384], [0.541, 2.6954824892773863], [0.505, 2.6866465345764516], [0.539, 2.545511939552054], [0.611, 2.5518379293540945], [0.595, 2.447077994772905], [0.401, 3.18141689613457], [0.472, 3.140789422711728], [0.44, 3.122383034882248], [0.417, 3.1000718468786865], [0.436, 3.033194365793023], [0.551, 2.5077409580139687], [0.52, 2.6396966922604843], [0.537, 2.7475280699413784], [0.588, 2.48176991845821], [0.563, 2.5491671804676717], [0.611, 2.656660398497624], [0.592, 2.5459332938150787], [0.585, 2.628561979159116], [0.609, 2.548348739275489], [0.575, 2.5795297355048192], [0.935, 3.1758620078685604], [0.907, 3.0349755215199195], [0.878, 2.9599747825227825], [0.834, 3.210217251817448], [0.914, 3.1032147339485876], [0.891, 3.0459050119297775], [0.919, 3.186207733739649], [0.927, 3.078205183686812], [0.93, 2.949745299913811], [0.914, 2.879746084400197], [0.752, 2.241098823264389], [0.724, 2.2488633179106783], [0.673, 2.374665727085344], [0.728, 2.3073844925293803], [0.769, 2.2359263727378766], [0.784, 2.166461993718542], [0.809, 2.2151062997039186], [0.774, 2.355783894304825], [0.818, 2.3880543535068623], [0.808, 2.3140397319888133], [0.801, 2.380779634627332], [0.691, 2.2498067902551058], [0.66, 2.2298020704113086], [0.709, 2.268577349923986], [0.711, 2.146530464833459], [0.743, 2.0086335931384354], [0.755, 2.064662877886159], [0.733, 2.1023161644649946], [0.753, 2.0207895944876624], [0.721, 1.9603766211604654], [0.739, 1.9777912436252212], [0.77, 2.0390655806029074], [0.779, 2.0539396766283358], [0.782, 2.0210781469633967], [0.809, 1.973952430723794], [0.777, 2.24471203655729], [0.486, 2.750722526056682], [0.441, 2.727711172668642], [0.496, 2.7092862938975864], [0.548, 2.79598308879476], [0.579, 2.7128195168797498], [0.818, 3.1173387853491734], [0.835, 3.1206714269618523], [0.659, 3.2095057742302613], [0.657, 3.102112377524811], [0.57, 3.0768963667500278], [0.683, 3.0835372171062105], [0.686, 2.9667944694490065], [0.697, 2.970096188310561], [0.812, 2.805018278111114], [0.868, 2.9673703476717384], [0.865, 2.930214530556462], [0.837, 2.9653074977981557], [0.88, 3.18270715836392], [0.844, 3.224412946071361], [0.664, 2.704393728092468], [0.559, 2.668913068801891], [0.572, 2.6619383417317657], [0.543, 2.775884487629976], [0.575, 2.7656185515200664], [0.579, 2.631948437964387], [0.615, 2.6910855750024782], [0.601, 2.8385784160910417]]
# f1=0
# time=0
# for i in cro:
# f1+=i[0]
# time+=i[1]
# print(f1/len(cro))
# print(time/len(cro))
# import pickle
# with open("yolo_720p.txt", "rb") as get_myprofile:
# result = pickle.load(get_myprofile)
# print(result)
# images_direc='D:\\VASRL\\server\\server\\my_dds_sr_619\\dataset\\video_test\\src'
# fnames = sorted(os.listdir(images_direc))
# sizelist=[]
# for fname in fnames:
# if "png" not in fname:
# continue
# filepath = os.path.join(images_direc, fname)
# #print(filepath)
# data=os.path.getsize(filepath) #查看filepath文件大小
# sizelist.append(data)
# print(sizelist)