institutional-exhibit 0.4.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 smithlopes
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.
@@ -0,0 +1,15 @@
1
+ Metadata-Version: 2.4
2
+ Name: institutional-exhibit
3
+ Version: 0.4.1
4
+ Summary: Fixed-layout matplotlib frames and theme for report-ready charts
5
+ Author-email: Smith Lopes <smith.lugia@gmail.com>
6
+ License: MIT
7
+ Requires-Python: >=3.9
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: matplotlib>=3.7
11
+ Requires-Dist: numpy
12
+ Requires-Dist: fonttools>=4.40
13
+ Dynamic: license-file
14
+
15
+ # Institutional-exhibit
@@ -0,0 +1 @@
1
+ # Institutional-exhibit
@@ -0,0 +1,9 @@
1
+ from .fonts import register_inter
2
+
3
+ register_inter() # must run before Frame is used
4
+
5
+ from .frame import Frame
6
+ from .spec import SPEC
7
+ from .theme import THEME, inr, usd_bn
8
+
9
+ __all__ = ["Frame", "SPEC", "THEME", "usd_bn", "inr"]
@@ -0,0 +1,93 @@
1
+ Copyright 2020 The Inter Project Authors (https://github.com/rsms/inter)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ https://openfontlicense.org
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,51 @@
1
+ from pathlib import Path
2
+ from tempfile import gettempdir
3
+
4
+ from matplotlib import font_manager as fm
5
+
6
+ _CANDIDATE_DIRS = [
7
+ Path(__file__).parent / "fonts", # bundled copies, if you add them
8
+ Path.home() / "Library" / "fonts", # macOS user fonts
9
+ Path("/Library/Fonts"),
10
+ Path.home() / ".fonts",
11
+ Path.home() / ".local" / "share" / "fonts",
12
+ Path("/usr/share/fonts/truetype/inter"),
13
+ ]
14
+ _REGULAR = "Inter-VariableFont_opsz,wght.ttf"
15
+ _ITALIC = "Inter-Italic-VariableFont_opsz,wght.ttf"
16
+
17
+
18
+ def _find(name):
19
+ for d in _CANDIDATE_DIRS:
20
+ if (d / name).exists():
21
+ return d / name
22
+ return None
23
+
24
+
25
+ def register_inter() -> bool:
26
+ """Register Inter (regular, italic, generated ExtraBold). False if unavailable."""
27
+ reg, ita = _find(_REGULAR), _find(_ITALIC)
28
+ if reg is None:
29
+ return False
30
+ fm.fontManager.addfont(str(reg))
31
+ if ita is not None:
32
+ fm.fontManager.addfont(str(ita))
33
+
34
+ try:
35
+ from fontTools.ttLib import TTFont
36
+ from fontTools.varLib.instancer import instantiateVariableFont
37
+ except ImportError:
38
+ return True # regular/italic only
39
+
40
+ xb = Path(gettempdir()) / "institutional-exhibit-inter-extrabold.ttf"
41
+ if not xb.exists():
42
+ font = instantiateVariableFont(TTFont(str(reg)), {"opsz": 32, "wght": 800},
43
+ inplace=False)
44
+ names = {1: "Inter ExtraBold", 2: "Regular", 4: "Inter ExtraBold",
45
+ 6: "Inter-ExtraBold", 16: "Inter ExtraBold", 17: "Regular"}
46
+ for rec in font["name"].names:
47
+ if rec.nameID in names:
48
+ rec.string = names[rec.nameID].encode(rec.getEncoding())
49
+ font.save(str(xb))
50
+ fm.fontManager.addfont(str(xb))
51
+ return True
@@ -0,0 +1,265 @@
1
+ from __future__ import annotations
2
+
3
+ import re
4
+ from dataclasses import dataclass
5
+
6
+ import matplotlib as mpl
7
+ import numpy as np
8
+ from matplotlib.backends.backend_agg import FigureCanvasAgg
9
+ from matplotlib.figure import Figure
10
+ from matplotlib.lines import Line2D
11
+ from matplotlib.patches import Patch, Rectangle
12
+ from matplotlib.transforms import Bbox, IdentityTransform
13
+
14
+ from .spec import SPEC
15
+ from .theme import THEME
16
+
17
+ S = SPEC
18
+ T = THEME
19
+
20
+ _DOLLAR = re.compile(r"(?<!\\)\$")
21
+
22
+
23
+ def _esc(s: str) -> str:
24
+ """Escape bare $ so matplotlib doesn't treat it as mathtext."""
25
+ return _DOLLAR.sub(r"\\$", s)
26
+
27
+
28
+ @dataclass
29
+ class Frame:
30
+ width: int = 1920
31
+ height: int = 1080
32
+ title: str = ""
33
+ subtitle: str = ""
34
+ source: str = ""
35
+ note: str = ""
36
+ dpi: int = 100
37
+ background: str = "#FFFFFF"
38
+ debug: bool = False # draws margin lines + plot-area box
39
+
40
+ def __post_init__(self):
41
+ # House font for everything, including tick labels, axis titles and legend
42
+ mpl.rcParams["font.family"] = list(S.font)
43
+ mpl.rcParams["text.hinting"] = "no_hinting"
44
+
45
+ self.fig = Figure(figsize=(self.width / self.dpi, self.height / self.dpi),
46
+ dpi=self.dpi, facecolor=self.background)
47
+ self.canvas = FigureCanvasAgg(self.fig)
48
+ self._renderer = self.canvas.get_renderer()
49
+ self._axes = []
50
+ self._legend_items = []
51
+ self._legend = None
52
+ self._build()
53
+
54
+ # ---------- helpers ----------
55
+ def _pt(self, px: float) -> float:
56
+ return px * 72 / self.dpi
57
+
58
+ def _wrap(self, text, size_px, weight, style, max_w, family=None):
59
+ if not text:
60
+ return []
61
+ t = self.fig.text(0, 0, "", fontsize=self._pt(size_px),
62
+ fontfamily=list(family or S.font),
63
+ fontweight=weight, fontstyle=style)
64
+ lines, cur = [], ""
65
+ for word in text.split():
66
+ trial = f"{cur} {word}".strip()
67
+ t.set_text(_esc(trial))
68
+ if cur and t.get_window_extent(self._renderer).width > max_w:
69
+ lines.append(cur)
70
+ cur = word
71
+ else:
72
+ cur = trial
73
+ if cur:
74
+ lines.append(cur)
75
+ t.remove()
76
+ return lines
77
+
78
+ def _draw(self, lines, top, lh, base, size, weight, style, color, family=None):
79
+ for i, line in enumerate(lines):
80
+ y = top + i * lh + base # baseline position, px from top
81
+ self.fig.text(S.margin_x / self.width, 1 - y / self.height, _esc(line),
82
+ ha="left", va="baseline", color=color,
83
+ fontsize=self._pt(size), fontfamily=list(family or S.font),
84
+ fontweight=weight, fontstyle=style)
85
+
86
+ # ---------- layout ----------
87
+ def _build(self):
88
+ W, H = self.width, self.height
89
+ w = W - 2 * S.margin_x
90
+
91
+ title = self._wrap(self.title, S.title_size, S.title_weight, "normal", w,
92
+ family=S.title_font)
93
+ sub_top = S.margin_top + len(title) * S.title_lh + S.title_gap
94
+ sub = self._wrap(self.subtitle, S.subtitle_size, 400, "normal", w)
95
+
96
+ note = self._wrap(self.note, S.footer_size, 400, "italic", w)
97
+ src = self._wrap(self.source, S.footer_size, 400, "italic", w)
98
+
99
+ # Bottom-up: note always ends exactly margin_bottom above the image edge.
100
+ note_top = H - S.margin_bottom - len(note) * S.footer_lh
101
+ src_top = note_top - S.footer_gap - len(src) * S.footer_lh
102
+
103
+ # 22px measured from visible ink, not from the line boxes:
104
+ # top: bottom of the last subtitle line's descenders -> plot area
105
+ # bottom: plot area -> top of the source line's capital letters
106
+ self.plot_top = (sub_top + (len(sub) - 1) * S.subtitle_lh
107
+ + S.subtitle_baseline + S.subtitle_descent + S.gap)
108
+ self.plot_bottom = src_top + S.footer_baseline - S.footer_cap - S.gap
109
+ self.plot_left = S.margin_x
110
+ self.plot_right = W - S.margin_x
111
+
112
+ if self.plot_bottom <= self.plot_top:
113
+ raise ValueError("Text is too long for this canvas height: "
114
+ "no room left for the plot area.")
115
+
116
+ self._draw(title, S.margin_top, S.title_lh, S.title_baseline,
117
+ S.title_size, S.title_weight, "normal", T.ink, family=S.title_font)
118
+ self._draw(sub, sub_top, S.subtitle_lh, S.subtitle_baseline,
119
+ S.subtitle_size, 400, "normal", T.subtitle_ink)
120
+ self._draw(src, src_top, S.footer_lh, S.footer_baseline,
121
+ S.footer_size, 400, "italic", T.foot)
122
+ self._draw(note, note_top, S.footer_lh, S.footer_baseline,
123
+ S.footer_size, 400, "italic", T.foot)
124
+
125
+ if self.debug:
126
+ self._draw_debug()
127
+
128
+ @property
129
+ def plot_rect_px(self):
130
+ """(left, top, width, height) in px, origin top-left."""
131
+ return (self.plot_left, self.plot_top,
132
+ self.plot_right - self.plot_left, self.plot_bottom - self.plot_top)
133
+
134
+ def _draw_debug(self):
135
+ ident = IdentityTransform()
136
+ W, H = self.width, self.height
137
+ self.fig.add_artist(Rectangle((self.plot_left, H - self.plot_bottom),
138
+ self.plot_right - self.plot_left,
139
+ self.plot_bottom - self.plot_top,
140
+ transform=ident, facecolor="#D9D9D9", zorder=-10))
141
+ m = dict(transform=ident, color="#F17000", lw=1)
142
+ for xs, ys in [((0, W), (H - S.margin_top,) * 2),
143
+ ((0, W), (S.margin_bottom,) * 2),
144
+ ((S.margin_x,) * 2, (0, H)),
145
+ ((W - S.margin_x,) * 2, (0, H))]:
146
+ self.fig.add_artist(Line2D(xs, ys, **m))
147
+
148
+ # ---------- themed axes ----------
149
+ def _style_axes(self, ax, twin=False):
150
+ pt = self._pt
151
+ ax.set_facecolor("none")
152
+ for s in ("top", "right", "left", "bottom"):
153
+ ax.spines[s].set_visible(False)
154
+
155
+ if not twin:
156
+ ax.set_axisbelow(True)
157
+ ax.grid(True, axis="y", linestyle="--", linewidth=pt(T.grid_w),
158
+ color=T.grid, zorder=0)
159
+ for s in ("left", "bottom"):
160
+ ax.spines[s].set_visible(True)
161
+ ax.spines[s].set_color(T.axis)
162
+ ax.spines[s].set_linewidth(pt(T.spine_w))
163
+ ax.tick_params(axis="x", length=pt(T.xtick_len), width=pt(T.tick_w),
164
+ pad=pt(T.xtick_pad), labelsize=pt(T.tick_size), colors=T.ink)
165
+ else:
166
+ ax.patch.set_visible(False)
167
+ ax.spines["right"].set_visible(True)
168
+ ax.spines["right"].set_color(T.axis)
169
+ ax.spines["right"].set_linewidth(pt(T.spine_w))
170
+
171
+ ax.tick_params(axis="y", length=0, pad=pt(T.ytick_pad),
172
+ labelsize=pt(T.tick_size), colors=T.ink)
173
+
174
+ def add_axes(self, twin=False):
175
+ """Themed axes filling the plot area. twin=True returns (ax, ax2).
176
+ Call fit() once everything is plotted."""
177
+ l, t, w, h = self.plot_rect_px
178
+ ax = self.fig.add_axes([l / self.width, 1 - (t + h) / self.height,
179
+ w / self.width, h / self.height])
180
+ self._style_axes(ax)
181
+ self._axes = [ax]
182
+ if twin:
183
+ ax2 = ax.twinx()
184
+ self._style_axes(ax2, twin=True)
185
+ self._axes.append(ax2)
186
+ return ax, ax2
187
+ return ax
188
+
189
+ # ---------- themed plotting ----------
190
+ def stacked_bars(self, ax, x, series, labels, width=0.7, partial_last=False):
191
+ """Stacked bars in theme colours; adds each series to the legend."""
192
+ x = np.asarray(x)
193
+ bottom = np.zeros(len(x))
194
+ for i, (vals, lab) in enumerate(zip(series, labels)):
195
+ c = T.series[i % len(T.series)]
196
+ vals = np.asarray(vals, dtype=float)
197
+ bars = ax.bar(x, vals, width=width, bottom=bottom, color=c,
198
+ edgecolor="white", linewidth=self._pt(T.bar_edge_w), zorder=3)
199
+ if partial_last:
200
+ bars.patches[-1].set_alpha(T.partial_alpha)
201
+ bottom = bottom + vals
202
+ self._legend_items.append((Patch(facecolor=c), lab))
203
+
204
+ def line(self, ax, x, y, label):
205
+ """Line with white-faced markers in the theme line colour; adds it to the legend."""
206
+ kw = dict(color=T.line, linewidth=self._pt(T.line_w), marker="o",
207
+ markersize=self._pt(T.marker), markerfacecolor="white",
208
+ markeredgewidth=self._pt(T.marker_edge_w))
209
+ ax.plot(x, y, zorder=5, **kw)
210
+ self._legend_items.append((Line2D([0], [0], **kw), label))
211
+
212
+ def add_legend_item(self, handle, label):
213
+ """Add a custom legend entry (appears after the auto-collected ones)."""
214
+ self._legend_items.append((handle, label))
215
+
216
+ def ylabels(self, ax, left, ax2=None, right=None):
217
+ kw = dict(fontsize=self._pt(T.label_size), color=T.ink,
218
+ labelpad=self._pt(T.label_pad))
219
+ ax.set_ylabel(_esc(left), **kw)
220
+ if ax2 is not None and right:
221
+ ax2.set_ylabel(_esc(right), **kw)
222
+
223
+ # ---------- legend + fitting ----------
224
+ def _place_legend(self):
225
+ """Legend at the bottom of the plot area. Returns its height in px."""
226
+ if not self._legend_items:
227
+ return 0.0
228
+ if self._legend is not None:
229
+ self._legend.remove()
230
+ handles, labels = zip(*self._legend_items)
231
+ self._legend = self.fig.legend(
232
+ handles, [_esc(l) for l in labels],
233
+ loc="lower center",
234
+ bbox_to_anchor=(0.5, (self.height - self.plot_bottom) / self.height),
235
+ ncol=len(labels), frameon=False, borderpad=0, borderaxespad=0,
236
+ fontsize=self._pt(T.legend_size),
237
+ handlelength=T.legend_handlelength,
238
+ columnspacing=T.legend_columnspacing,
239
+ handletextpad=T.legend_handletextpad)
240
+ for txt in self._legend.get_texts():
241
+ txt.set_color(T.ink)
242
+ return self._legend.get_window_extent(self._renderer).height
243
+
244
+ def fit(self, iterations=5):
245
+ """Place the legend at the bottom, then resize the axes so axes + tick labels
246
+ + axis titles fill the rest of the plot area exactly."""
247
+ axes = self._axes
248
+ W, H = self.width, self.height
249
+ leg_h = self._place_legend()
250
+ reserve = leg_h + T.legend_gap if leg_h else 0.0
251
+ target = Bbox.from_extents(self.plot_left, H - self.plot_bottom + reserve,
252
+ self.plot_right, H - self.plot_top)
253
+ main = axes[0]
254
+ for _ in range(iterations):
255
+ bb = Bbox.union([a.get_tightbbox(self._renderer) for a in axes])
256
+ p = main.get_position()
257
+ x0, x1, y0, y1 = p.x0 * W, p.x1 * W, p.y0 * H, p.y1 * H
258
+ new = Bbox.from_extents(
259
+ target.x0 + (x0 - bb.x0), target.y0 + (y0 - bb.y0),
260
+ target.x1 - (bb.x1 - x1), target.y1 - (bb.y1 - y1))
261
+ for a in axes:
262
+ a.set_position([new.x0 / W, new.y0 / H, new.width / W, new.height / H])
263
+
264
+ def save(self, path, **kw):
265
+ self.fig.savefig(path, dpi=self.dpi, facecolor=self.background, **kw)
@@ -0,0 +1,37 @@
1
+ from dataclasses import dataclass
2
+
3
+
4
+ @dataclass(frozen=True)
5
+ class Spec:
6
+ """House-style constants. Frozen: assignment raises FrozenInstanceError."""
7
+ font: tuple = ("Inter", "Helvetica", "Arial", "DejaVu Sans")
8
+ title_font: tuple = ("Inter ExtraBold",)
9
+ title_weight: int = 800 # "Inter ExtraBold" only exists at weight 800
10
+
11
+ # margins and gaps (px)
12
+ margin_x: float = 60
13
+ margin_top: float = 40
14
+ margin_bottom: float = 40 # note end -> image bottom, always constant
15
+ gap: float = 30 # subtitle ink -> plot area, plot area -> source ink
16
+ title_gap: float = 5.4 # title -> subtitle
17
+ footer_gap: float = 2 # source -> note
18
+
19
+ # typography (px)
20
+ title_size: float = 47.56
21
+ title_lh: float = 57.6
22
+ subtitle_size: float = 20.23
23
+ subtitle_lh: float = 24
24
+ footer_size: float = 16
25
+ footer_lh: float = 20
26
+
27
+ # baseline offsets from the top of each line box (px)
28
+ title_baseline: float = 43
29
+ subtitle_baseline: float = 21
30
+ footer_baseline: float = 15
31
+
32
+ # ink metrics used to measure the 22px gaps (px)
33
+ subtitle_descent: float = 4.3 # baseline -> bottom of descenders
34
+ footer_cap: float = 11.5 # cap height of the footer text
35
+
36
+
37
+ SPEC = Spec()
@@ -0,0 +1,46 @@
1
+ from dataclasses import dataclass
2
+
3
+ from matplotlib.ticker import FuncFormatter
4
+
5
+
6
+ @dataclass(frozen=True)
7
+ class Theme:
8
+ """Chart styling. Sizes are canvas px (converted to points at draw time)."""
9
+ # colours
10
+ series: tuple = ("#6b8fd1", "#e8856a", "#55a868", "#9b8ac4") # blue, orange, green, purple
11
+ line: str = "#fcb149"
12
+ ink: str = "#000000"
13
+ subtitle_ink: str = "#000000"
14
+ foot: str = "#8c8c8c"
15
+ axis: str = "#7f7f7f"
16
+ grid: str = "#b9b9b9"
17
+
18
+ # text inside the plot area
19
+ tick_size: float = 17.33
20
+ label_size: float = 17.33
21
+ label_pad: float = 16.67
22
+ legend_size: float = 18.33
23
+ legend_handlelength: float = 1.6
24
+ legend_columnspacing: float = 1.8
25
+ legend_handletextpad: float = 0.7
26
+ legend_gap: float = 20 # tick labels -> legend
27
+
28
+ # lines
29
+ spine_w: float = 2.5
30
+ grid_w: float = 1.67
31
+ tick_w: float = 2.0
32
+ xtick_len: float = 8.33
33
+ xtick_pad: float = 13.33
34
+ ytick_pad: float = 8.33
35
+ bar_edge_w: float = 0.83
36
+ line_w: float = 4.67
37
+ marker: float = 8.33
38
+ marker_edge_w: float = 2.0
39
+ partial_alpha: float = 0.6 # for a partial final period
40
+
41
+
42
+ THEME = Theme()
43
+
44
+ # Tick formatters ($ is escaped so matplotlib doesn't read it as mathtext)
45
+ usd_bn = FuncFormatter(lambda v, _: f"US\\${v:,.0f}bn")
46
+ inr = FuncFormatter(lambda v, _: f"₹{v:,.0f}")
@@ -0,0 +1,15 @@
1
+ Metadata-Version: 2.4
2
+ Name: institutional-exhibit
3
+ Version: 0.4.1
4
+ Summary: Fixed-layout matplotlib frames and theme for report-ready charts
5
+ Author-email: Smith Lopes <smith.lugia@gmail.com>
6
+ License: MIT
7
+ Requires-Python: >=3.9
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: matplotlib>=3.7
11
+ Requires-Dist: numpy
12
+ Requires-Dist: fonttools>=4.40
13
+ Dynamic: license-file
14
+
15
+ # Institutional-exhibit
@@ -0,0 +1,16 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ institutional_exhibit/__init__.py
5
+ institutional_exhibit/fonts.py
6
+ institutional_exhibit/frame.py
7
+ institutional_exhibit/spec.py
8
+ institutional_exhibit/theme.py
9
+ institutional_exhibit.egg-info/PKG-INFO
10
+ institutional_exhibit.egg-info/SOURCES.txt
11
+ institutional_exhibit.egg-info/dependency_links.txt
12
+ institutional_exhibit.egg-info/requires.txt
13
+ institutional_exhibit.egg-info/top_level.txt
14
+ institutional_exhibit/fonts/Inter-Italic-VariableFont_opsz,wght.ttf
15
+ institutional_exhibit/fonts/Inter-VariableFont_opsz,wght.ttf
16
+ institutional_exhibit/fonts/OFL.txt
@@ -0,0 +1,3 @@
1
+ matplotlib>=3.7
2
+ numpy
3
+ fonttools>=4.40
@@ -0,0 +1 @@
1
+ institutional_exhibit
@@ -0,0 +1,19 @@
1
+ [project]
2
+ name = "institutional-exhibit"
3
+ version = "0.4.1"
4
+ description = "Fixed-layout matplotlib frames and theme for report-ready charts"
5
+ readme = "README.md"
6
+ requires-python = ">=3.9"
7
+ license = { text = "MIT" }
8
+ authors = [{ name = "Smith Lopes", email = "smith.lugia@gmail.com" }]
9
+ dependencies = ["matplotlib>=3.7", "numpy", "fonttools>=4.40"]
10
+
11
+ [build-system]
12
+ requires = ["setuptools>=61"]
13
+ build-backend = "setuptools.build_meta"
14
+
15
+ [tool.setuptools.packages.find]
16
+ include = ["institutional_exhibit*"]
17
+
18
+ [tool.setuptools.package-data]
19
+ institutional_exhibit = ["fonts/*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+