├── LinLibertine_R.ttf ├── README.md ├── TIMES.TTF ├── drawfigure.py ├── figure1.pdf ├── figure2.pdf ├── figure3.pdf ├── figure4.pdf ├── figure5.pdf ├── figure6.png ├── pics ├── figure1.png ├── figure2.png ├── figure3.png ├── figure4.png ├── figure5.png ├── figure6.png ├── figure7.png └── readme.md └── tsne_results /LinLibertine_R.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DaoD/ResearchFigure/a842e7c264beced66167fc113221e821ae7e3049/LinLibertine_R.ttf -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ResearchFigure 2 | Some example codes for drawing figures in research paper 3 | 4 | ### Requirements 5 | - matplotlib 6 | - numpy 7 | 8 | ### Hints 9 | - *Times* font is better for AI or NLP conferences, such as AAAI, ACL, EMNLP, etc. 10 | - *Linux Libertine* font is better for ACM conferences, such as SIGIR, WWW, CIKM, WSDM, etc. 11 | 12 | ### Useful links 13 | [Colors in matplotlib 1](https://matplotlib.org/stable/gallery/color/named_colors.html)
14 | [Colors in matplotlib 2](https://matplotlib.org/stable/tutorials/colors/colors.html)
15 | 16 | ### Line chart with shared x-axis 17 | ``` 18 | draw_figure_1() 19 | ``` 20 | ![Figure1](https://github.com/DaoD/ResearchFigure/blob/main/pics/figure1.png) 21 | ``` 22 | draw_figure_5() 23 | ``` 24 | ![Figure1](https://github.com/DaoD/ResearchFigure/blob/main/pics/figure5.png) 25 | 26 | ### Histogram with different groups 27 | ``` 28 | draw_figure_2() 29 | ``` 30 | ![Figure2](https://github.com/DaoD/ResearchFigure/blob/main/pics/figure2.png) 31 | 32 | ### Two histograms 33 | ``` 34 | draw_figure_3() 35 | ``` 36 | ![Figure3](https://github.com/DaoD/ResearchFigure/blob/main/pics/figure3.png) 37 | 38 | ### Two line charts 39 | ``` 40 | draw_figure_4() 41 | ``` 42 | ![Figure4](https://github.com/DaoD/ResearchFigure/blob/main/pics/figure4.png) 43 | 44 | ### TSNE figure 45 | ``` 46 | draw_figure_6() 47 | ``` 48 | ![Figure6](https://github.com/DaoD/ResearchFigure/blob/main/pics/figure6.png) 49 | 50 | ### Line chart with histogram + Two y-axis 51 | ``` 52 | draw_figure_7() 53 | ``` 54 | ![Figure7](https://github.com/DaoD/ResearchFigure/blob/main/pics/figure7.png) 55 | -------------------------------------------------------------------------------- /TIMES.TTF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DaoD/ResearchFigure/a842e7c264beced66167fc113221e821ae7e3049/TIMES.TTF -------------------------------------------------------------------------------- /drawfigure.py: -------------------------------------------------------------------------------- 1 | import matplotlib.pyplot as plt 2 | from matplotlib.font_manager import FontProperties 3 | from mpl_toolkits.axes_grid1 import make_axes_locatable 4 | import numpy as np 5 | import torch 6 | 7 | # fname must be the absolute path !!! 8 | myfont1 = FontProperties(fname="/Users/yutao/Desktop/TIMES.ttf", size=22) 9 | myfont2 = FontProperties(fname='/Users/yutao/Desktop/LinLibertine_R.ttf', size=32) 10 | myfont3 = FontProperties(fname='/Users/yutao/Desktop/LinLibertine_R.ttf', size=22) 11 | myfont4 = FontProperties(fname='/Users/yutao/Desktop/LinLibertine_R.ttf', size=26) 12 | myfont5 = FontProperties(fname='/Users/yutao/Desktop/LinLibertine_R.ttf', size=24) 13 | myfont6 = FontProperties(fname='/Users/yutao/Desktop/LinLibertine_R.ttf', size=20) 14 | myfont7 = FontProperties(size=14) 15 | myfont8 = FontProperties(size=12) 16 | 17 | def draw_figrue_1(): 18 | r2_1 = [0.740, 0.746, 0.748, 0.756, 0.744, 0.750, 0.761, 0.744, 0.742, 0.734] 19 | r10_1 = [0.376, 0.384, 0.388, 0.387, 0.377, 0.379, 0.398, 0.373, 0.378, 0.367] 20 | mrr = [0.489, 0.485, 0.491, 0.489, 0.493, 0.489, 0.502, 0.491, 0.498, 0.494] 21 | 22 | fig, ax = plt.subplots(3, sharex=True, figsize=(8, 6)) 23 | plt.subplots_adjust(hspace=0) 24 | 25 | x_ticks = np.linspace(0.1, 1.0, 10) 26 | x_labels = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0] 27 | y_ticks1 = np.linspace(0.72, 0.77, 6) 28 | y_ticks2 = np.linspace(0.48, 0.51, 4) 29 | y_ticks3 = np.linspace(0.36, 0.4, 5) 30 | ax[0].plot(x_labels, r2_1, 'go-', label="R2@1") 31 | ax[1].plot(x_labels, mrr, 'b^-', label="MRR") 32 | ax[2].plot(x_labels, r10_1, 'rv-', label="R10@1") 33 | ax[2].set_xticks(x_ticks) 34 | ax[2].xaxis.set_tick_params(labelsize=14) 35 | ax[0].set_yticks(y_ticks1) 36 | ax[1].set_yticks(y_ticks2) 37 | ax[2].set_yticks(y_ticks3) 38 | ax[0].yaxis.set_tick_params(labelsize=14) 39 | ax[1].yaxis.set_tick_params(labelsize=14) 40 | ax[2].yaxis.set_tick_params(labelsize=14) 41 | ax[0].set_ylim(0.725, 0.77) 42 | ax[1].set_ylim(0.475, 0.51) 43 | ax[2].set_ylim(0.365, 0.4) 44 | ax[0].tick_params(bottom=False) 45 | ax[0].spines['bottom'].set_visible(False) 46 | ax[1].spines['top'].set_visible(False) 47 | ax[1].spines['bottom'].set_visible(False) 48 | ax[2].spines['top'].set_visible(False) 49 | for i, txt in enumerate(r2_1): 50 | t = ax[0].annotate("%.3f" % txt, (x_labels[i], r2_1[i] + 0.002), ha='center') 51 | t.set_fontsize(14) 52 | for i, txt in enumerate(mrr): 53 | t = ax[1].annotate("%.3f" % txt, (x_labels[i], mrr[i] + 0.002), ha='center') 54 | t.set_fontsize(14) 55 | for i, txt in enumerate(r10_1): 56 | t = ax[2].annotate("%.3f" % txt, (x_labels[i], r10_1[i] + 0.002), ha='center') 57 | t.set_fontsize(14) 58 | d = .005 59 | kwargs = dict(transform=ax[0].transAxes, color='k', clip_on=False) 60 | ax[0].plot((-d, +d), (-d, +d), **kwargs) 61 | ax[0].plot((1 - d, 1 + d), (-d, +d), **kwargs) 62 | 63 | kwargs.update(transform=ax[1].transAxes) 64 | ax[0].plot((-d, +d), (1 - d, 1 + d), **kwargs) 65 | ax[0].plot((1 - d, 1 + d), (1 - d, 1 + d), **kwargs) 66 | 67 | kwargs = dict(transform=ax[1].transAxes, color='k', clip_on=False) 68 | ax[1].plot((-d, +d), (-d, +d), **kwargs) 69 | ax[1].plot((1 - d, 1 + d), (-d, +d), **kwargs) 70 | 71 | kwargs.update(transform=ax[2].transAxes) 72 | ax[1].plot((-d, +d), (1 - d, 1 + d), **kwargs) 73 | ax[1].plot((1 - d, 1 + d), (1 - d, 1 + d), **kwargs) 74 | 75 | ax[0].grid(alpha=0.8, linestyle='-') 76 | ax[0].legend(prop={'size': 16}) 77 | ax[1].grid(alpha=0.8, linestyle='-') 78 | ax[1].legend(prop={'size': 16}, loc="upper left") 79 | ax[2].grid(alpha=0.8, linestyle='-') 80 | ax[2].legend(prop={'size': 16}) 81 | plt.xlabel(r'$\lambda$', fontsize=14) 82 | plt.tight_layout() 83 | # plt.show() 84 | plt.savefig("./figure1.pdf") 85 | 86 | def draw_figure_2(): 87 | label_list = ['0', '(0,0.2)', '[0.2,0.4)', '[0.4,0.6)', '[0.6,0.8)', '[0.8,1]'] 88 | p_strict_sws = [0.2091269841269841, 0.3030013247226363, 0.44205425061906556, 0.4910003050246953, 0.5527537277537277, 0.49428571428571433] 89 | p_weak_sws = [0.22106392106392106, 0.3205253648901191, 0.46131253006253015, 0.510060828963268, 0.563666426166426, 0.5276190476190475] 90 | p_strict_sw = [0.22857679107679105, 0.26725332954841174, 0.4182105445994338, 0.47823062213306106, 0.5194083694083694, 0.5461904761904762] 91 | p_weak_sw = [0.23413234663234656, 0.2731276464883025, 0.43141846151105434, 0.4834700078602517, 0.5233766233766234, 0.5461904761904762] 92 | # p_strict_dua = [0.1721364221364221, 0.18431800439997173, 0.23367415335007943, 0.27002281819354973, 0.30228475228475227, 0.2752380952380952] 93 | # p_weak_dua = [0.1828346203346203, 0.22036450571286653, 0.26307597580745756, 0.2975747603796383, 0.3290043290043291, 0.3038095238095238] 94 | p_strict_msn = [0.19460531960531957, 0.233750413975824, 0.3419656218267334, 0.4102632011168599, 0.48554593554593556, 0.5342857142857144] 95 | p_weak_msn = [0.21825396825396817, 0.27174348875168575, 0.37706151016336237, 0.4297240699679726, 0.512000962000962, 0.5676190476190476] 96 | coverage_ratio = [0.09181141439205956, 0.3027295285359802, 0.40074441687344914, 0.15384615384615385, 0.04466501240694789, 0.00620347394540943] 97 | 98 | x = np.arange(6) 99 | 100 | total_width, n = 0.8, 7 # 有多少个类型,只需更改n即可 101 | width = total_width / n 102 | x = x - (total_width - width) / 2 103 | 104 | plt.figure(figsize=(16, 8)) 105 | plt.bar(x, p_strict_sws, width=width, label='P strict of SW*', hatch=2*'//', edgecolor='w') 106 | plt.bar(x + width, p_weak_sws, width=width, label='P weak of SW*', hatch=2*'.', edgecolor='w') 107 | # plt.bar(x + 2 * width, num_list_3, width=width, label='CEOS', hatch=4*'\\', edgecolor='w') 108 | plt.bar(x + 2 * width, p_strict_sw, width=width, label='P strict of SW', hatch=4*'//', edgecolor='w') 109 | plt.bar(x + 3 * width, p_weak_sw, width=width, label='P weak of SW', hatch=4*'.', edgecolor='w') 110 | plt.bar(x + 4 * width, p_strict_msn, width=width, label='P strict of MSN', hatch=4*'\\', edgecolor='w') 111 | plt.bar(x + 5 * width, p_weak_msn, width=width, label='P weak of MSN', hatch='.', edgecolor='w') 112 | plt.bar(x + 6 * width, coverage_ratio, width=width, label='Percentage(%)', hatch=2*'\\', edgecolor='w') 113 | plt.xticks([index + 3 * width for index in x], label_list, fontproperties=myfont1) 114 | plt.yticks(fontproperties=myfont1) 115 | plt.legend(prop=myfont1) 116 | plt.tight_layout() 117 | plt.savefig("./figure2.pdf", format="pdf") 118 | # plt.show() 119 | 120 | def draw_figure_3(): 121 | coca_map = [0.552700927070873, 0.543403267053195, 0.4876967263751009] 122 | duet_map = [0.4031463588267755, 0.39543176001219477, 0.384521141975356] 123 | cars_map = [0.4331293302456068, 0.4232857811441042, 0.3982938125484895] 124 | hba_map = [0.5315612397803664, 0.5264386514846908, 0.4780848161335488] 125 | 126 | coca_ndcg3 = [0.5502390266892377, 0.5390684662493154, 0.48418425092634415] 127 | duet_ndcg3 = [0.38460203985733127, 0.3762263757389652, 0.3671913235364889] 128 | cars_ndcg3 = [0.41548140827936514, 0.4038658384980803, 0.38140468885004214] 129 | hba_ndcg3 = [0.5277788066111762, 0.5212777296124101, 0.4729313905099101] 130 | 131 | x = np.arange(3) 132 | total_width, n = 0.8, 4 # 有多少个类型,只需更改n即可 133 | width = total_width / n 134 | x = x - (total_width - width) / 2 135 | label_list = ["Short", "Medium", "Long"] 136 | 137 | fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(16, 8)) 138 | ax1.bar(x, duet_map, width=width, label='Duet', hatch=2 * '\\', edgecolor='w', color="#d62728") 139 | ax1.bar(x + width, cars_map, width=width, label='CARS', hatch=2 * '//', edgecolor='w', color="#1f77b4") 140 | ax1.bar(x + 2 * width, hba_map, width=width, label='HBA', hatch=2 * '.', edgecolor='w', color="#ff7f0e") 141 | ax1.bar(x + 3 * width, coca_map, width=width, label='COCA', hatch=4 * '\\', edgecolor='w', color="#2ca02c") 142 | ax1.set_xticks([index + 1.5 * width for index in x]) 143 | ax1.set_xticklabels(label_list, fontproperties=myfont2) 144 | # plt.yticks(y_label) 145 | ax1.set_yticklabels(["0.30", "0.35", "0.40", "0.45", "0.50", "0.55", "0.60"], fontproperties=myfont2) 146 | ax1.set_ylim(0.3, 0.6) 147 | ax1.legend(prop=myfont3) 148 | ax1.set_ylabel("MAP", fontproperties=myfont2) 149 | 150 | ax2.bar(x, duet_ndcg3, width=width, label='Duet', hatch=2 * '\\', edgecolor='w', color="#d62728") 151 | ax2.bar(x + width, cars_ndcg3, width=width, label='CARS', hatch=2 * '//', edgecolor='w', color="#1f77b4") 152 | ax2.bar(x + 2 * width, hba_ndcg3, width=width, label='HBA', hatch=2 * '.', edgecolor='w', color="#ff7f0e") 153 | ax2.bar(x + 3 * width, coca_ndcg3, width=width, label='COCA', hatch=4 * '\\', edgecolor='w', color="#2ca02c") 154 | ax2.set_xticks([index + 1.5 * width for index in x]) 155 | ax2.set_xticklabels(label_list, fontproperties=myfont2) 156 | ax2.set_yticklabels(["0.30", "0.35", "0.40", "0.45", "0.50", "0.55", "0.60"], fontproperties=myfont2) 157 | ax2.set_ylim(0.3, 0.6) 158 | ax2.legend(prop=myfont3) 159 | ax2.set_ylabel("NDCG@3", fontproperties=myfont2) 160 | 161 | plt.tight_layout() 162 | plt.savefig("./figure3.pdf", format="pdf") 163 | 164 | def draw_figure_4(): 165 | fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 6)) 166 | 167 | x = [0.2, 0.4, 0.6, 0.8, 1] 168 | map = [0.5458, 0.5469, 0.5468, 0.5496, 0.5500] 169 | ndcg3 = [0.5429, 0.5433, 0.5441, 0.5475, 0.5478] 170 | nocl_map = [0.5341, 0.5341, 0.5341, 0.5341, 0.5341] 171 | nocal_ndcg3 = [0.5296, 0.5296, 0.5296, 0.5296, 0.5296] 172 | x_value = [0.2, 0.4, 0.6, 0.8, 1.0] 173 | x_label = ["20%", "40%", "60%", "80%", "100%"] 174 | ax1.plot(x, map, 'o-', color='#1f77b4', label="CL-MAP") 175 | ax1.plot(x, ndcg3, '^-' ,color='#ff7f0e', label="CL-NDCG@3") 176 | ax1.plot(x, nocl_map, 'o--', color='#1f77b4', label="None-MAP") 177 | ax1.plot(x, nocal_ndcg3, '^--' ,color='#ff7f0e', label="None-NDCG@3") 178 | ax1.set_ylim(0.525, 0.551) 179 | ax1.set_xticks(x_value) 180 | ax1.set_xticklabels(x_label, fontproperties=myfont4) 181 | ax1.set_yticklabels(["0.525", "0.530", "0.535", "0.540", "0.545", "0.550"], fontproperties=myfont4) 182 | ax1.legend(prop=myfont3, loc="center right", bbox_to_anchor=(1.0, 0.55)) 183 | ax1.set_xlabel("Data Amount", fontproperties=myfont4) 184 | ax1.grid(alpha=0.3, linestyle='--') 185 | 186 | map = [0.5462, 0.5472, 0.5481, 0.5500, 0.5497] 187 | ndcg3 = [0.5433, 0.5450, 0.5452, 0.5478, 0.5476] 188 | nocl_map = [0.5341, 0.5341, 0.5341, 0.5341, 0.5341] 189 | nocal_ndcg3 = [0.5296, 0.5296, 0.5296, 0.5296, 0.5296] 190 | 191 | x = [1, 2, 3, 4, 5] 192 | ax2.plot(x, map, 'o-', color='#1f77b4', label="CL-MAP") 193 | ax2.plot(x, ndcg3, '^-' ,color='#ff7f0e', label="CL-NDCG@3") 194 | ax2.plot(x, nocl_map, 'o--', color='#1f77b4', label="None-MAP") 195 | ax2.plot(x, nocal_ndcg3, '^--' ,color='#ff7f0e', label="None-NDCG@3") 196 | ax2.set_ylim(0.525, 0.551) 197 | ax2.set_xticks(x) 198 | ax2.set_xticklabels([1, 2, 3, 4, 5], fontproperties=myfont4) 199 | ax2.set_yticklabels(["0.525", "0.530", "0.535", "0.540", "0.545", "0.550"], fontproperties=myfont4) 200 | ax2.legend(prop=myfont3, loc="center right", bbox_to_anchor=(1.0, 0.55)) 201 | ax2.set_xlabel("Training Epoch", fontproperties=myfont4) 202 | ax2.grid(alpha=0.3, linestyle='--') 203 | 204 | plt.tight_layout() 205 | plt.savefig("./figure4.pdf") 206 | 207 | def draw_figure_5(): 208 | pmr_5_pred = [8.23, 12.54, 15.01, 14.78, 15.05, 14.74] 209 | pmr_5_ground = [33.85, 65.88, 89.50, 100.0, 100.0, 100.0] 210 | pmr_3_pred = [10.72, 17.57, 18.42, 18.44, 18.75, 18.89] 211 | pmr_3_ground = [60.47, 100.0, 100.0, 100.0, 100.0, 100.0] 212 | pmr_2_pred = [17.33, 17.53 ,17.43, 17.59, 17.53, 17.61] 213 | pmr_2_ground = [100.0, 100.0, 100.0, 100.0, 100.0, 100.0] 214 | x_labels = [1, 2, 3, 4, 5, 6] 215 | 216 | fig, ax = plt.subplots(2, sharex=True, figsize=(9, 6)) 217 | plt.subplots_adjust(hspace=0.01) 218 | 219 | y_ticks1 = np.linspace(30, 100, 8) 220 | y_ticks2 = np.linspace(6, 20, 8) 221 | 222 | ax[1].plot(x_labels, pmr_5_pred, 'o-', label=r'$d=1$') 223 | ax[1].plot(x_labels, pmr_3_pred, 'o-', label=r'$d=2$') 224 | ax[1].plot(x_labels, pmr_2_pred, 'o-', label=r'$d=4$') 225 | ax[0].plot(x_labels, pmr_5_ground, 'o--', label=r'$d=1$ ground-turth') 226 | ax[0].plot(x_labels, pmr_3_ground, 'o--', label=r'$d=2$ ground-turth') 227 | ax[0].plot(x_labels, pmr_2_ground, 'o--', label=r'$d=4$ ground-turth') 228 | 229 | ax[1].xaxis.set_tick_params(labelsize=14) 230 | ax[0].set_yticks(y_ticks1) 231 | ax[1].set_yticks(y_ticks2) 232 | ax[0].yaxis.set_tick_params(labelsize=14) 233 | ax[1].yaxis.set_tick_params(labelsize=14) 234 | ax[0].tick_params(bottom=False) 235 | ax[0].spines['bottom'].set_visible(False) 236 | ax[1].spines['top'].set_visible(False) 237 | d = .008 238 | kwargs = dict(transform=ax[0].transAxes, color='k', clip_on=False) 239 | ax[0].plot((-d, +d), (-d, +d), **kwargs) 240 | ax[0].plot((1 - d, 1 + d), (-d, +d), **kwargs) 241 | kwargs.update(transform=ax[1].transAxes) 242 | ax[0].plot((-d, +d), (1 - d, 1 + d), **kwargs) 243 | ax[0].plot((1 - d, 1 + d), (1 - d, 1 + d), **kwargs) 244 | 245 | ax[0].grid(alpha=0.8, linestyle='-') 246 | legend = ax[0].legend(prop={'size': 15}, title='PMR') 247 | legend.get_title().set_fontsize('15') 248 | ax[1].grid(alpha=0.8, linestyle='-') 249 | legend = ax[1].legend(prop={'size': 15}, title='PMR') 250 | legend.get_title().set_fontsize('15') 251 | 252 | plt.xlabel(r'$L$', fontsize=16) 253 | plt.tight_layout() 254 | plt.savefig('./figure5.pdf') 255 | 256 | def draw_figure_6(): 257 | node_sne, inp_sne = torch.load("./tsne_results") 258 | (fig, subplots) = plt.subplots(1, 2, figsize=(10, 4)) 259 | c_target = [0, 1, 2, 3, 4] 260 | 261 | ax = subplots[0] 262 | for i in range(len(inp_sne[0])): 263 | result_x = [inp_sne[0][i, 0], inp_sne[1][i, 0], inp_sne[2][i, 0], inp_sne[3][i, 0], inp_sne[4][i, 0]] 264 | result_y = [inp_sne[0][i, 1], inp_sne[1][i, 1], inp_sne[2][i, 1], inp_sne[3][i, 1], inp_sne[4][i, 1]] 265 | im = ax.scatter(result_x, result_y, c=c_target, cmap="jet", s=1) 266 | ax.axis('off') 267 | ax.set_title('(a) Input embeddings', y=-0.1, fontproperties=myfont5) 268 | 269 | ax = subplots[1] 270 | for i in range(len(node_sne[0])): 271 | result_x = [node_sne[0][i, 0], node_sne[1][i, 0], node_sne[2][i, 0], node_sne[3][i, 0], node_sne[4][i, 0]] 272 | result_y = [node_sne[0][i, 1], node_sne[1][i, 1], node_sne[2][i, 1], node_sne[3][i, 1], node_sne[4][i, 1]] 273 | im = ax.scatter(result_x, result_y, c=c_target, cmap="jet", s=1) 274 | ax.axis('off') 275 | 276 | ax.set_title('(b) Updated representations', y=-0.1, fontproperties=myfont5) 277 | 278 | divider = make_axes_locatable(plt.gca()) 279 | cax = divider.append_axes("right", "3%", pad="7%") 280 | cbar = plt.colorbar(im, cax=cax) 281 | cbar.set_ticks([0, 4]) 282 | cbar.set_ticklabels(["First\nSentences", "Last\nSentence"]) 283 | for label in cbar.ax.get_yticklabels(): 284 | label.set_fontproperties(myfont6) 285 | cbar.ax.tick_params(size=0) 286 | cbar.outline.set_visible(False) 287 | plt.tight_layout() 288 | plt.savefig("./figure6.png", dpi=300) # tsne figure has a lot of points, use png instead of pdf 289 | 290 | def draw_figure_7(): 291 | fig, ax1 = plt.subplots(1, 1, figsize=(6, 4)) 292 | PD_BERT = [0.296, 0.309, 0.316, 0.324, 0.328, 0.329, 0.332, 0.335, 0.337, 0.340] 293 | PTinyBERT = [0.277, 0.289, 0.301, 0.307, 0.317, 0.318, 0.324, 0.327, 0.332, 0.334] 294 | Unique = [539264, 957589, 1321446, 1660668, 1989253, 2312669, 2633543, 2953503, 3272902, 3592060] 295 | Unique_norm = [x / 1000000 for x in Unique] 296 | 297 | x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] 298 | x_value = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] 299 | x_label = ["0.1", "0.2", "0.3", "0.4", "0.5", "0.6", "0.7", "0.8", "0.9", "1.0"] 300 | ax1.plot(x, PD_BERT, 'o-', label="PD-BERT") 301 | ax1.plot(x, PTinyBERT, '^-', label="STinyBERT+Pairwise") 302 | ax1.set_ylim(0.26, 0.36) 303 | ax1.set_xticks(x_value) 304 | ax1.set_xticklabels(x_label, fontproperties=myfont7) 305 | for label in ax1.get_xticklabels(): 306 | label.set_fontproperties(myfont7) 307 | for label in ax1.get_yticklabels(): 308 | label.set_fontproperties(myfont7) 309 | ax1.set_ylabel('MRR@10', fontproperties=myfont7) 310 | ax1.set_xlabel('Training Data Amount (Ratio)', fontproperties=myfont7) 311 | ax1.legend(prop=myfont8, loc="center", bbox_to_anchor=(0.5, 0.92), ncol=3) 312 | ax1.grid(alpha=0.3, linestyle='--') 313 | 314 | ax2 = ax1.twinx() 315 | ax2.bar(x, Unique_norm, width=0.6, edgecolor='w', hatch="//", color="forestgreen", alpha=.8) 316 | ax2.set_ylim(0, 5) 317 | for label in ax2.get_yticklabels(): 318 | label.set_fontproperties(myfont7) 319 | ax2.set_ylabel("# Positive Samples (M)", fontproperties=myfont7) 320 | 321 | plt.tight_layout() 322 | plt.savefig("./figure7.pdf") 323 | 324 | # draw_figrue_1() 325 | # draw_figure_2() 326 | # draw_figure_3() 327 | # draw_figure_4() 328 | # draw_figure_5() 329 | # draw_figure_6() 330 | # draw_figure_7() 331 | -------------------------------------------------------------------------------- /figure1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DaoD/ResearchFigure/a842e7c264beced66167fc113221e821ae7e3049/figure1.pdf -------------------------------------------------------------------------------- /figure2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DaoD/ResearchFigure/a842e7c264beced66167fc113221e821ae7e3049/figure2.pdf -------------------------------------------------------------------------------- /figure3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DaoD/ResearchFigure/a842e7c264beced66167fc113221e821ae7e3049/figure3.pdf -------------------------------------------------------------------------------- /figure4.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DaoD/ResearchFigure/a842e7c264beced66167fc113221e821ae7e3049/figure4.pdf -------------------------------------------------------------------------------- /figure5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DaoD/ResearchFigure/a842e7c264beced66167fc113221e821ae7e3049/figure5.pdf -------------------------------------------------------------------------------- /figure6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DaoD/ResearchFigure/a842e7c264beced66167fc113221e821ae7e3049/figure6.png -------------------------------------------------------------------------------- /pics/figure1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DaoD/ResearchFigure/a842e7c264beced66167fc113221e821ae7e3049/pics/figure1.png -------------------------------------------------------------------------------- /pics/figure2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DaoD/ResearchFigure/a842e7c264beced66167fc113221e821ae7e3049/pics/figure2.png -------------------------------------------------------------------------------- /pics/figure3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DaoD/ResearchFigure/a842e7c264beced66167fc113221e821ae7e3049/pics/figure3.png -------------------------------------------------------------------------------- /pics/figure4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DaoD/ResearchFigure/a842e7c264beced66167fc113221e821ae7e3049/pics/figure4.png -------------------------------------------------------------------------------- /pics/figure5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DaoD/ResearchFigure/a842e7c264beced66167fc113221e821ae7e3049/pics/figure5.png -------------------------------------------------------------------------------- /pics/figure6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DaoD/ResearchFigure/a842e7c264beced66167fc113221e821ae7e3049/pics/figure6.png -------------------------------------------------------------------------------- /pics/figure7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DaoD/ResearchFigure/a842e7c264beced66167fc113221e821ae7e3049/pics/figure7.png -------------------------------------------------------------------------------- /pics/readme.md: -------------------------------------------------------------------------------- 1 | example 2 | -------------------------------------------------------------------------------- /tsne_results: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DaoD/ResearchFigure/a842e7c264beced66167fc113221e821ae7e3049/tsne_results --------------------------------------------------------------------------------