├── .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 | 
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 |
1411 |
--------------------------------------------------------------------------------