|
61 | 61 | 't':'top', |
62 | 62 | } |
63 | 63 |
|
| 64 | +# Dimensions of figures for common journals |
| 65 | +JOURNAL_SPECS = { |
| 66 | + 'pnas1': '8.7cm', # if 1 number specified, this is a tuple |
| 67 | + 'pnas2': '11.4cm', |
| 68 | + 'pnas3': '17.8cm', |
| 69 | + 'ams1': 3.2, # spec is in inches |
| 70 | + 'ams2': 4.5, |
| 71 | + 'ams3': 5.5, |
| 72 | + 'ams4': 6.5, |
| 73 | + 'agu1': ('95mm', '115mm'), |
| 74 | + 'agu2': ('190mm', '115mm'), |
| 75 | + 'agu3': ('95mm', '230mm'), |
| 76 | + 'agu4': ('190mm', '230mm'), |
| 77 | + 'aaas1': '5.5cm', # AAAS (e.g., Science) 1 column |
| 78 | + 'aaas2': '12cm', # AAAS 2 column |
| 79 | + } |
| 80 | + |
| 81 | + |
64 | 82 | #-----------------------------------------------------------------------------# |
65 | 83 | # Miscellaneous stuff |
66 | 84 | #-----------------------------------------------------------------------------# |
@@ -1630,28 +1648,16 @@ def _iter_axes(self): |
1630 | 1648 | #-----------------------------------------------------------------------------# |
1631 | 1649 | def _journals(journal): |
1632 | 1650 | """Journal sizes for figures.""" |
1633 | | - table = { |
1634 | | - 'pnas1': '8.7cm', # if 1 number specified, this is a tuple |
1635 | | - 'pnas2': '11.4cm', |
1636 | | - 'pnas3': '17.8cm', |
1637 | | - 'ams1': 3.2, # spec is in inches |
1638 | | - 'ams2': 4.5, |
1639 | | - 'ams3': 5.5, |
1640 | | - 'ams4': 6.5, |
1641 | | - 'agu1': ('95mm', '115mm'), |
1642 | | - 'agu2': ('190mm', '115mm'), |
1643 | | - 'agu3': ('95mm', '230mm'), |
1644 | | - 'agu4': ('190mm', '230mm'), |
1645 | | - } |
1646 | | - value = table.get(journal, None) |
| 1651 | + # Get dimensions for figure from common journals. |
| 1652 | + value = JOURNAL_SPECS.get(journal, None) |
1647 | 1653 | if value is None: |
1648 | 1654 | raise ValueError(f'Unknown journal figure size specifier {journal!r}. ' + |
1649 | | - 'Current options are: ' + ', '.join(table.keys())) |
| 1655 | + 'Current options are: ' + ', '.join(JOURNAL_SPECS.keys())) |
1650 | 1656 | # Return width, and optionally also the height |
1651 | 1657 | width, height = None, None |
1652 | 1658 | try: |
1653 | 1659 | width, height = value |
1654 | | - except TypeError: |
| 1660 | + except (TypeError, ValueError): |
1655 | 1661 | width = value |
1656 | 1662 | return width, height |
1657 | 1663 |
|
|
0 commit comments