├── .gitignore ├── images ├── figure2.png ├── overlap.png ├── font_is_futura.png ├── development │ ├── overlap.afdesign │ └── measurements.afdesign └── test.svg ├── oldplotlib.py ├── current_issues.md ├── LICENSE ├── oldplotlib.mplstyle ├── readme.md ├── figure_observations.md └── test.py /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_store 2 | *.pyc 3 | -------------------------------------------------------------------------------- /images/figure2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckinzthompson/oldplotlib/HEAD/images/figure2.png -------------------------------------------------------------------------------- /images/overlap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckinzthompson/oldplotlib/HEAD/images/overlap.png -------------------------------------------------------------------------------- /images/font_is_futura.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckinzthompson/oldplotlib/HEAD/images/font_is_futura.png -------------------------------------------------------------------------------- /images/development/overlap.afdesign: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckinzthompson/oldplotlib/HEAD/images/development/overlap.afdesign -------------------------------------------------------------------------------- /images/development/measurements.afdesign: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckinzthompson/oldplotlib/HEAD/images/development/measurements.afdesign -------------------------------------------------------------------------------- /oldplotlib.py: -------------------------------------------------------------------------------- 1 | ## how to: 'import oldplotlib as plt' at the start of a file 2 | 3 | from matplotlib.pyplot import * 4 | style.use('./oldplotlib.mplstyle') 5 | -------------------------------------------------------------------------------- /current_issues.md: -------------------------------------------------------------------------------- 1 | # current issues 2 | - Find a better math font 3 | - make the lines a little wobbly like from a photocopier 4 | - y axis tick labels from 0.0 to 0 5 | - better yaxis tick label spacing 6 | - single plot dimensions? 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) [year] [fullname] 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /oldplotlib.mplstyle: -------------------------------------------------------------------------------- 1 | 2 | ## Canvas 3 | figure.facecolor: ffffff 4 | figure.figsize: 3.0,2.5 5 | figure.dpi: 150 6 | 7 | 8 | ## Subplots 9 | figure.subplot.left: 0.08 10 | figure.subplot.right: 0.987 11 | figure.subplot.bottom: 0.073 12 | figure.subplot.top: 0.975 13 | figure.subplot.hspace: 0.0475 14 | 15 | axes.spines.right: True 16 | axes.spines.top: True 17 | 18 | axes.facecolor: ffffff 19 | axes.edgecolor: 000000 20 | axes.linewidth: 1#0.75 21 | axes.grid: False 22 | 23 | 24 | ## Ticks 25 | xtick.top: True 26 | xtick.bottom: True 27 | xtick.major.size: 5.0 28 | xtick.major.width: 0.75 29 | xtick.minor.width: 0.75 30 | xtick.direction: in 31 | xtick.minor.visible: False 32 | xtick.alignment: center 33 | 34 | ytick.left: True 35 | ytick.right: True 36 | ytick.major.size: 5.0 37 | ytick.major.width: 0.75 38 | ytick.minor.width: 0.75 39 | ytick.direction: in 40 | ytick.minor.visible: False 41 | ytick.alignment: center 42 | 43 | 44 | ## Tick Labels 45 | xtick.major.pad: 2.4 46 | xtick.labelsize: 6.0 47 | 48 | ytick.major.pad: 2.54 49 | ytick.labelsize: 6.0 50 | 51 | 52 | ## Axis Labels 53 | axes.labelsize: 8 54 | axes.labelpad: -2.5 55 | 56 | ## Lines 57 | axes.prop_cycle: cycler('color', ['000000',]) 58 | lines.linewidth: 1.25 59 | lines.dashed_pattern: 1.5, 0.5 ## tuple is backwards... 60 | 61 | 62 | ## Fonts 63 | font.family: Futura 64 | font.size: 7.75 65 | mathtext.fontset: stixsans #dejavusans 66 | pdf.fonttype: 42 67 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # oldplotlib 2 | A Matplotlib stylesheet to replicate the figure style of Changeux and Kittel in: 3 | >Changeux, J.-P., Thiery, J., Tung, Y. & Kittel, C. ON THE COOPERATIVITY OF BIOLOGICAL MEMBRANES. Proceedings of the National Academy of Sciences 57, 335–341 (1967). 4 | 5 | Specifically, the style is to match figure 2: 6 | 7 | 8 | 9 | 10 | ## How to Use 11 | There are two ways to use this stylesheet for your figures 12 | 13 | First, download the [stylesheet](oldplotlib.mplstyle), then 14 | 15 | ``` Python 16 | import matplotlib.pyplot as plt 17 | plt.style.use('/path/to/the/oldplotlib.mplstyle') 18 | ``` 19 | The second way is a a simple wrapper over matplotlib.pyplot that essentially types the previous option in for you. Instead of doing `import matplotlib.pyplot as plt` in your file, use 20 | 21 | ``` Python 22 | import oldplotlib as plt 23 | ``` 24 | 25 | 26 | ## Development of oldplotlib 27 | people: @ckinzthompson @korakray 28 | 29 | feel free to contribute and/or suggestion new plots styles to emulate 30 | 31 | #### Information: 32 | * [Observations about the figure](figure_observations.md) 33 | * [Current style issues to be corrected](current_issues.md) 34 | * [Current test figure code](test.py) 35 | 36 | #### Current: 37 | 38 | 39 | 40 | #### Overlap original (red) / oldplotlib (black): 41 | 42 | 43 | -------------------------------------------------------------------------------- /figure_observations.md: -------------------------------------------------------------------------------- 1 | 2 | ### Notes about the Figure style 3 | First, the image is slightly tilted, and it's difficult to rotate perfectly straight. The following observations were made by measuring various things in a vector image editor program 4 | 5 | #### Canvas 6 | canvas dimensions are 3"x2.5" W:H 7 | offsets are 0.23" left, 0.05" right, 0.2" bottom, 0.05" top, hspace = 0.05" 8 | on [0,1] this is: .077, .983, .08, 0.98, hspace = .02 9 | 10 | #### Subplot Axes 11 | - axes bbox has all four sides 12 | - the axes box is 2.72" x 1.10", with 1pt line thickness 13 | 14 | #### Ticks 15 | - it seems the ticks are inward facing and maybe .7-.8 pt thick -- 0.75? 16 | - ticks seem to be 0.07in long (maybe 0.065... but i dont' think so) 17 | - x axis has 6 ticks, include two entirely side ones (4 in middle) 18 | - y axis has 3 ticks, including two entirely side ones (1 in middle) 19 | 20 | #### Tick Labels 21 | - tick labels are font size 6 futura with 0% tracking 22 | - tick labels (Y) are LHS .165" and RHS .035" from axis line 23 | - tick labels (X) are TOP .032" and BOTTOM .105" from axis line 24 | 25 | ### Axis Labels 26 | - axis label (X) is TOP .128" and BOTTOM .184" from axis line 27 | - axis label is font size 8 28 | 29 | ### Lines 30 | - plot lines are 1.25 pt 31 | - dashed lines are 1.25 pt, with dash parameters of (.5, 1.5) (length,skip?) 32 | 33 | ### Fonts 34 | - The font is Futura (medium) 35 | ![](./images/font_is_futura.png) 36 | - The font size is 7.75 pt 37 | - The spacing btw lines is 11 pt font spacing 38 | - any math/greek (〈𝓁Λ〉) letters are in some weird serif font... switch to MPL default (so go with dejavu serif or STIX Two) 39 | - Sometimes long numbers have -75% tracking between letters 40 | -------------------------------------------------------------------------------- /test.py: -------------------------------------------------------------------------------- 1 | if __name__ == '__main__': 2 | # import matplotlib.pyplot as plt 3 | # plt.style.use('./oldplotlib.mplstyle') 4 | import oldplotlib as plt 5 | import numpy as np 6 | from scipy.optimize import newton 7 | 8 | fig,ax = plt.subplots(2) 9 | 10 | ## top plot 11 | c = 0. 12 | l = 20. 13 | lam = .01 14 | 15 | r = np.linspace(0,1.,1000) 16 | alpha_r = r*l*lam**r / (1.-r) - 1. 17 | y_r = alpha_r/(1. + alpha_r + l * lam**r ) 18 | 19 | cut_low = np.nonzero(np.bitwise_and(alpha_r<1,r<.4))[0][-1] 20 | cut_high = np.nonzero(np.bitwise_and(alpha_r>1,r>.6))[0][0] 21 | ax[0].plot([1.,1.],[y_r[cut_low],r[cut_high]],lw=1.) 22 | 23 | ax[0].plot(alpha_r[:cut_low],r[:cut_low],linestyle='-') ## pre 24 | ax[0].plot(alpha_r[cut_low:cut_high],r[cut_low:cut_high],linestyle='--') ## transition 25 | ax[0].plot(alpha_r[cut_high:],r[cut_high:],linestyle='-') ## post 26 | 27 | ax[0].plot(alpha_r[:cut_low],y_r[:cut_low],linestyle='-') ## pre 28 | ax[0].plot(alpha_r[cut_low:cut_high],y_r[cut_low:cut_high],linestyle='--') ## transition 29 | ax[0].plot(alpha_r[cut_high:],y_r[cut_high:],linestyle='-') ## post 30 | 31 | ax[0].annotate('State and binding functions',(2.15,.32),xycoords='data') 32 | ax[0].annotate('when $\ell$ = %d, c = %d, $\Lambda$ = %0.2f'%(l,c,lam),(2.15,.175),xycoords='data') 33 | ax[0].annotate(r'$\langle$r$\rangle$',(1.1,.89),xycoords='data') 34 | ax[0].annotate(r'$\langle$y$\rangle$',(1.66,.63),xycoords='data') 35 | 36 | ## bottom plot 37 | c = 0. 38 | l = 10. 39 | lam = .02 40 | 41 | r = np.linspace(0,1.,1000) 42 | alpha_r = r*l*lam**r / (1.-r) - 1. 43 | y_r = alpha_r/(1. + alpha_r + l * lam**r ) 44 | 45 | ax[1].plot(alpha_r,r,linestyle='-') 46 | ax[1].plot(alpha_r,y_r,linestyle='-') 47 | 48 | ax[1].annotate('State and binding functions',(2.15,.32),xycoords='data') 49 | ax[1].annotate('when $\ell$ = %d, c = %d, $\Lambda$ = %0.2f'%(l,c,lam),(2.15,.175),xycoords='data') 50 | ax[1].annotate(r'$\langle$r$\rangle$',(0.31,.76),xycoords='data') 51 | ax[1].annotate(r'$\langle$y$\rangle$',(1.15,.56),xycoords='data') 52 | 53 | 54 | ## fix axes 55 | for aa in ax: 56 | aa.set_xticks((0,1,2,3,4,5)) 57 | aa.set_xlim(-.0175,5) 58 | aa.set_ylim(0.,1.) 59 | aa.set_yticks([0,.5,1.]) 60 | 61 | ax[0].set_xticklabels(()) 62 | ax[1].set_xlabel(r'$\alpha$') 63 | 64 | #### very custom figure matching fixes 65 | for aa in ax: 66 | xticks = aa.xaxis.get_major_ticks() 67 | xticks[0].tick1line.set_visible(False) 68 | xticks[0].tick2line.set_visible(False) 69 | 70 | ax[0].yaxis.get_major_ticks()[0].label1.set_verticalalignment('bottom') 71 | ax[1].yaxis.get_major_ticks()[-1].label1.set_verticalalignment('top') 72 | 73 | # #### Why doesn't this change the text? it changes the color! 74 | # for aa in ax: 75 | # yticks = aa.yaxis.get_major_ticks() 76 | # yticks[0].label1.set(text='red',color='r') 77 | # plt.show() 78 | 79 | 80 | ###### 81 | fig.savefig('images/test.pdf') 82 | plt.show() 83 | -------------------------------------------------------------------------------- /images/test.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 2021-06-13T18:41:33.008208 11 | image/svg+xml 12 | 13 | 14 | Matplotlib v3.3.1, https://matplotlib.org/ 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 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 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 161 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 259 | 260 | 261 | 274 | 275 | 276 | 305 | 306 | 307 | 325 | 326 | 327 | 338 | 339 | 340 | 365 | 366 | 367 | 389 | 390 | 391 | 394 | 395 | 396 | 399 | 400 | 401 | 404 | 405 | 406 | 409 | 410 | 411 | 412 | 413 | 414 | 444 | 458 | 481 | 507 | 508 | 525 | 548 | 571 | 587 | 619 | 640 | 656 | 675 | 696 | 721 | 722 | 723 | 724 | 725 | 726 | 727 | 728 | 729 | 730 | 731 | 732 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | 740 | 741 | 742 | 743 | 744 | 745 | 746 | 747 | 748 | 749 | 750 | 751 | 752 | 753 | 754 | 755 | 767 | 784 | 814 | 825 | 845 | 851 | 860 | 861 | 862 | 863 | 864 | 865 | 866 | 867 | 868 | 869 | 870 | 871 | 872 | 873 | 874 | 875 | 876 | 877 | 878 | 879 | 880 | 881 | 882 | 883 | 884 | 885 | 886 | 887 | 888 | 889 | 890 | 891 | 892 | 893 | 894 | 895 | 904 | 917 | 926 | 927 | 928 | 929 | 930 | 931 | 932 | 933 | 934 | 935 | 936 | 946 | 947 | 948 | 949 | 950 | 951 | 952 | 953 | 954 | 955 | 961 | 962 | 963 | 964 | 965 | 966 | 967 | 968 | 969 | 970 | 971 | 972 | 973 | 974 | 975 | 976 | 977 | 978 | 979 | 980 | 981 | 982 | 983 | 984 | 985 | 986 | 987 | 988 | 989 | 990 | 991 | 992 | 993 | 994 | 995 | 996 | 997 | 998 | 999 | 1000 | 1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 1007 | 1008 | 1009 | 1010 | 1011 | 1012 | 1013 | 1014 | 1015 | 1016 | 1017 | 1018 | 1019 | 1020 | 1021 | 1022 | 1050 | 1051 | 1052 | 1053 | 1054 | 1055 | 1056 | 1057 | 1058 | 1059 | 1060 | 1061 | 1062 | 1063 | 1064 | 1065 | 1066 | 1067 | 1068 | 1069 | 1070 | 1085 | 1086 | 1087 | 1088 | 1089 | 1090 | 1091 | 1092 | 1093 | 1094 | 1095 | 1096 | 1097 | 1098 | 1099 | 1100 | 1101 | 1102 | 1103 | 1104 | 1105 | 1106 | 1107 | 1108 | 1109 | 1110 | 1111 | 1112 | 1140 | 1141 | 1142 | 1143 | 1144 | 1145 | 1146 | 1147 | 1148 | 1149 | 1150 | 1151 | 1152 | 1153 | 1154 | 1155 | 1156 | 1157 | 1158 | 1159 | 1160 | 1161 | 1162 | 1163 | 1164 | 1165 | 1166 | 1167 | 1168 | 1169 | 1170 | 1171 | 1172 | 1173 | 1174 | 1175 | 1176 | 1177 | 1178 | 1179 | 1180 | 1181 | 1182 | 1183 | 1184 | 1185 | 1186 | 1187 | 1188 | 1189 | 1190 | 1191 | 1192 | 1193 | 1194 | 1195 | 1196 | 1197 | 1198 | 1199 | 1200 | 1201 | 1202 | 1203 | 1204 | 1205 | 1206 | 1207 | 1208 | 1253 | 1254 | 1255 | 1298 | 1299 | 1300 | 1303 | 1304 | 1305 | 1308 | 1309 | 1310 | 1313 | 1314 | 1315 | 1318 | 1319 | 1320 | 1321 | 1322 | 1323 | 1324 | 1325 | 1326 | 1327 | 1328 | 1329 | 1330 | 1331 | 1332 | 1333 | 1334 | 1335 | 1336 | 1337 | 1338 | 1339 | 1340 | 1341 | 1342 | 1343 | 1344 | 1345 | 1346 | 1347 | 1348 | 1349 | 1350 | 1351 | 1352 | 1353 | 1354 | 1355 | 1356 | 1357 | 1358 | 1359 | 1360 | 1361 | 1362 | 1363 | 1364 | 1365 | 1366 | 1367 | 1368 | 1369 | 1370 | 1371 | 1372 | 1373 | 1374 | 1375 | 1376 | 1377 | 1378 | 1379 | 1380 | 1381 | 1382 | 1383 | 1384 | 1385 | 1386 | 1387 | 1388 | 1389 | 1390 | 1391 | 1392 | 1393 | 1394 | 1395 | 1396 | 1397 | 1398 | 1399 | 1400 | 1401 | 1402 | 1403 | 1404 | 1405 | 1406 | 1407 | 1408 | 1409 | 1410 | 1411 | --------------------------------------------------------------------------------