acadplot 0.2.0__tar.gz → 0.3.0__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.
- {acadplot-0.2.0 → acadplot-0.3.0}/PKG-INFO +109 -14
- {acadplot-0.2.0 → acadplot-0.3.0}/README.md +108 -13
- {acadplot-0.2.0 → acadplot-0.3.0}/pyproject.toml +1 -1
- {acadplot-0.2.0 → acadplot-0.3.0}/pyproject.toml.orig +1 -1
- {acadplot-0.2.0 → acadplot-0.3.0}/src/acadplot/__init__.py +1 -1
- {acadplot-0.2.0 → acadplot-0.3.0}/src/acadplot/styles.py +17 -2
- {acadplot-0.2.0 → acadplot-0.3.0}/LICENSE +0 -0
- {acadplot-0.2.0 → acadplot-0.3.0}/src/acadplot/bar.py +0 -0
- {acadplot-0.2.0 → acadplot-0.3.0}/src/acadplot/charts.py +0 -0
- {acadplot-0.2.0 → acadplot-0.3.0}/src/acadplot/draw.py +0 -0
- {acadplot-0.2.0 → acadplot-0.3.0}/src/acadplot/fonts/Arimo-Bold.ttf +0 -0
- {acadplot-0.2.0 → acadplot-0.3.0}/src/acadplot/fonts/Arimo-Italic.ttf +0 -0
- {acadplot-0.2.0 → acadplot-0.3.0}/src/acadplot/fonts/Arimo-Regular.ttf +0 -0
- {acadplot-0.2.0 → acadplot-0.3.0}/src/acadplot/fonts/Inconsolatazi4-Bold.otf +0 -0
- {acadplot-0.2.0 → acadplot-0.3.0}/src/acadplot/fonts/Inconsolatazi4-Regular.otf +0 -0
- {acadplot-0.2.0 → acadplot-0.3.0}/src/acadplot/fonts/LICENSE-Apache-2.0.txt +0 -0
- {acadplot-0.2.0 → acadplot-0.3.0}/src/acadplot/fonts/LICENSE-Inconsolata-OFL.txt +0 -0
- {acadplot-0.2.0 → acadplot-0.3.0}/src/acadplot/fonts/LICENSE-Libertinus-OFL.txt +0 -0
- {acadplot-0.2.0 → acadplot-0.3.0}/src/acadplot/fonts/LibertinusSerif-Bold.otf +0 -0
- {acadplot-0.2.0 → acadplot-0.3.0}/src/acadplot/fonts/LibertinusSerif-Italic.otf +0 -0
- {acadplot-0.2.0 → acadplot-0.3.0}/src/acadplot/fonts/LibertinusSerif-Regular.otf +0 -0
- {acadplot-0.2.0 → acadplot-0.3.0}/src/acadplot/fonts/README.md +0 -0
- {acadplot-0.2.0 → acadplot-0.3.0}/src/acadplot/line.py +0 -0
- {acadplot-0.2.0 → acadplot-0.3.0}/src/acadplot/plot.py +0 -0
- {acadplot-0.2.0 → acadplot-0.3.0}/src/acadplot/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: acadplot
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: A simple plotting tool using matplotlib for generating plots and subplots for research papers.
|
|
5
5
|
Author: Sudip Bhujel
|
|
6
6
|
Author-email: Sudip Bhujel <code@sudipbhujel.com.np>
|
|
@@ -63,9 +63,11 @@ The examples use the bundled fonts, so regenerating them needs no TeX installati
|
|
|
63
63
|
|
|
64
64
|
### Fonts and Series Styles
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
Each font preset with the venues it suits (see
|
|
67
|
+
[Choosing a Style for Your Venue](#choosing-a-style-for-your-venue)),
|
|
68
|
+
rendered with no TeX:
|
|
67
69
|
|
|
68
|
-
<img src="https://raw.githubusercontent.com/sudip-bhujel/acadplot/main/examples/
|
|
70
|
+
<img src="https://raw.githubusercontent.com/sudip-bhujel/acadplot/main/examples/venue_gallery.png" width="600">
|
|
69
71
|
|
|
70
72
|
`series_styles` keeps each method's color, marker, and hatch the same across
|
|
71
73
|
plot types:
|
|
@@ -76,13 +78,13 @@ plot types:
|
|
|
76
78
|
|
|
77
79
|
The examples cover all built-in themes and layout profiles:
|
|
78
80
|
|
|
79
|
-
- `
|
|
80
|
-
- `
|
|
81
|
-
- `nature` with `paper-1col`: bar plot
|
|
82
|
-
- `colorblind` with `paper-2col`: grouped bar plot for one column in a two-column paper
|
|
81
|
+
- `colorblind` (default) with `paper-1col`: line plot
|
|
82
|
+
- `colorblind` with `paper-2col`: compact monospace line plot and grouped bar plot for one column in a two-column paper
|
|
83
83
|
- `colorblind` with `paper-2col-subplot`: two small subplots inside one column of a two-column paper
|
|
84
|
+
- `nature` with `paper-1col`: bar plot
|
|
84
85
|
- `mono` with `paper-1col`: stacked bar plot
|
|
85
86
|
- `warm` with `presentation`: presentation-scale line plot
|
|
87
|
+
- all five themes, including `classic`: style gallery
|
|
86
88
|
|
|
87
89
|
<img src="https://raw.githubusercontent.com/sudip-bhujel/acadplot/main/examples/presentation_style.png" width="500">
|
|
88
90
|
|
|
@@ -262,6 +264,7 @@ built-in math rendering.
|
|
|
262
264
|
| `libertine` | ACM (`acmart`) body text | Libertinus Serif (bundled) | `libertine`, `newtxmath` |
|
|
263
265
|
| `times` | IEEE and most ML conference templates | STIXGeneral (ships with Matplotlib) | `newtxtext`, `newtxmath` |
|
|
264
266
|
| `helvetica` | journals that ask for sans-serif, such as Nature and Science | Arimo (bundled, Arial-compatible) | `helvet`, `mathastext` |
|
|
267
|
+
| `computer-modern` | Springer LNCS, Elsevier, plain LaTeX | Computer Modern (ships with Matplotlib) | none (the LaTeX default) |
|
|
265
268
|
|
|
266
269
|
```python
|
|
267
270
|
configure_plot_style(layout="paper-2col", theme="classic", font="times")
|
|
@@ -269,8 +272,9 @@ configure_plot_style(layout="paper-2col", theme="classic", font="times")
|
|
|
269
272
|
|
|
270
273
|
Each preset sets tick numbers in its own text font. Inconsolata has no matching
|
|
271
274
|
math font, so Greek letters and math symbols in labels (such as `$\alpha$`)
|
|
272
|
-
still render in a serif math font.
|
|
273
|
-
|
|
275
|
+
still render in a serif math font. Matplotlib's Computer Modern has no bold
|
|
276
|
+
face in the same family, so bold text such as panel labels renders in regular
|
|
277
|
+
weight. `serif` and `sans` remain as aliases of `times` and `helvetica`.
|
|
274
278
|
|
|
275
279
|
For two subplots inside one column of a two-column paper, let the layout drive
|
|
276
280
|
the figure size:
|
|
@@ -296,6 +300,96 @@ fig.subplots_adjust(left=0.14, right=0.99, bottom=0.24, top=0.86, wspace=0.18)
|
|
|
296
300
|
save(fig, "one_column_two_panel.pdf", tight_layout=False)
|
|
297
301
|
```
|
|
298
302
|
|
|
303
|
+
### Choosing a Style for Your Venue
|
|
304
|
+
|
|
305
|
+
Match the figure font to the paper's body text and draw the figure at the width
|
|
306
|
+
it will be printed, so point sizes in the PDF are the sizes readers see. Where a
|
|
307
|
+
column is narrower than `paper-2col` (3.35 in), the table gives a `fig_size` to
|
|
308
|
+
pass to each plot call.
|
|
309
|
+
|
|
310
|
+
**Security conferences**
|
|
311
|
+
|
|
312
|
+
| Venue | Template and body font | `font=` | One-column figure | Full-width figure |
|
|
313
|
+
|---|---|---|---|---|
|
|
314
|
+
| IEEE S&P | `IEEEtran`, Times | `"times"` | `paper-2col` (column 3.49 in) | `paper-2col-span` (7.14 in) |
|
|
315
|
+
| USENIX Security | `usenix-2020-09`, Times | `"times"` | `paper-2col` (column 3.33 in) | `paper-2col-span` (7.0 in) |
|
|
316
|
+
| ACM CCS | `acmart` `sigconf`, Libertine | `"libertine"` | `paper-2col` (column 3.33 in) | `paper-2col-span` (7.01 in) |
|
|
317
|
+
| NDSS | IEEE conference template, Times | `"times"` | `paper-2col` (column 3.49 in) | `paper-2col-span` (7.14 in) |
|
|
318
|
+
|
|
319
|
+
**Machine learning conferences**
|
|
320
|
+
|
|
321
|
+
| Venue | Template and body font | `font=` | One-column figure | Full-width figure |
|
|
322
|
+
|---|---|---|---|---|
|
|
323
|
+
| NeurIPS | NeurIPS style, Times | `"times"` | single column | `paper-1col` (5.5 in) |
|
|
324
|
+
| ICLR | ICLR style, Times | `"times"` | single column | `paper-1col` (5.5 in) |
|
|
325
|
+
| ICML | ICML style, Times | `"times"` | `fig_size=(3.25, 2.1)` (column 3.25 in) | `fig_size=(6.7, 2.8)` (6.75 in) |
|
|
326
|
+
| CVPR, ICCV | CVPR author kit, Times | `"times"` | `fig_size=(3.25, 2.1)` (column 3.28 in) | `paper-2col-span` (6.875 in) |
|
|
327
|
+
| ECCV | Springer LNCS, Computer Modern | `"computer-modern"` | single column | `fig_size=(4.8, 2.8)` (4.8 in) |
|
|
328
|
+
| ACL, EMNLP, NAACL | ACL style, Times | `"times"` | `fig_size=(3.0, 1.95)` (column 3.03 in) | `fig_size=(6.3, 2.6)` (6.3 in) |
|
|
329
|
+
| AAAI | AAAI style, Times | `"times"` | `paper-2col` | `paper-2col-span` |
|
|
330
|
+
| KDD | `acmart` `sigconf`, Libertine | `"libertine"` | `paper-2col` (column 3.33 in) | `paper-2col-span` (7.01 in) |
|
|
331
|
+
|
|
332
|
+
**Journals and other venues**
|
|
333
|
+
|
|
334
|
+
| Venue | Body font | `font=` | One-column figure | Full-width figure |
|
|
335
|
+
|---|---|---|---|---|
|
|
336
|
+
| IEEE Transactions | Times | `"times"` | `paper-2col` (column 3.49 in) | `paper-2col-span` (7.14 in) |
|
|
337
|
+
| Nature, Science, Cell | journals ask for sans-serif figure text | `"helvetica"`; for Nature add `font_size=7` (5–7 pt) | `paper-2col` (Nature: 89 mm) | `paper-2col-span` (Nature: 183 mm) |
|
|
338
|
+
| Springer LNCS, Elsevier `elsarticle`, plain LaTeX, theses | Computer Modern | `"computer-modern"` | single column | `fig_size=(4.8, 2.8)` (LNCS: 4.8 in) |
|
|
339
|
+
| Slides | — | `"helvetica"` | — | `presentation` |
|
|
340
|
+
|
|
341
|
+
On ACM venues, `font="inconsolata"` (the default) matches `acmart`'s code font
|
|
342
|
+
if you prefer a code-style look. Templates and journal rules change, so check
|
|
343
|
+
the current author guide. A few rules hold everywhere:
|
|
344
|
+
|
|
345
|
+
- Include the PDF at its natural size, `\includegraphics{figure.pdf}` without a
|
|
346
|
+
`width=`, so text keeps the size AcadPlot set. Scaling a figure to fit also
|
|
347
|
+
scales its text.
|
|
348
|
+
- Pass the same `fig_size=` to every plot call in a paper, or to
|
|
349
|
+
`plt.subplots(figsize=...)` for figures you build yourself.
|
|
350
|
+
- `fig_size` changes only the canvas; text keeps the layout's font sizes.
|
|
351
|
+
|
|
352
|
+
Example: a one-column figure for an IEEE S&P paper.
|
|
353
|
+
|
|
354
|
+
```python
|
|
355
|
+
from acadplot import configure_plot_style, plot_line, save
|
|
356
|
+
|
|
357
|
+
configure_plot_style(layout="paper-2col", font="times")
|
|
358
|
+
|
|
359
|
+
fig, _ = plot_line(
|
|
360
|
+
[
|
|
361
|
+
([1, 2, 3, 4, 5], [76.0, 79.5, 82.0, 83.0, 84.0], "Ours"),
|
|
362
|
+
([1, 2, 3, 4, 5], [74.0, 77.0, 79.0, 80.5, 81.5], "Baseline"),
|
|
363
|
+
],
|
|
364
|
+
location="lower right",
|
|
365
|
+
label=("Training budget", "Accuracy (%)"),
|
|
366
|
+
)
|
|
367
|
+
save(fig, "accuracy.pdf")
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
```latex
|
|
371
|
+
\begin{figure}
|
|
372
|
+
\centering
|
|
373
|
+
\includegraphics{accuracy.pdf}
|
|
374
|
+
\caption{Accuracy versus training budget.}
|
|
375
|
+
\end{figure}
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
<img src="https://raw.githubusercontent.com/sudip-bhujel/acadplot/main/examples/venue_ieee.png" width="335">
|
|
379
|
+
|
|
380
|
+
For other venues, change the style line and add `fig_size=` where the table
|
|
381
|
+
lists one:
|
|
382
|
+
|
|
383
|
+
```python
|
|
384
|
+
configure_plot_style(layout="paper-2col", font="times") # IEEE S&P, USENIX, NDSS, AAAI
|
|
385
|
+
configure_plot_style(layout="paper-2col", font="libertine") # ACM CCS, KDD
|
|
386
|
+
configure_plot_style(layout="paper-1col", font="times") # NeurIPS, ICLR
|
|
387
|
+
configure_plot_style(layout="paper-2col", font="times") # ICML, CVPR: plot_line(..., fig_size=(3.25, 2.1))
|
|
388
|
+
configure_plot_style(layout="paper-2col", font="times") # ACL, EMNLP: plot_line(..., fig_size=(3.0, 1.95))
|
|
389
|
+
configure_plot_style(layout="paper-1col", font="computer-modern") # ECCV, LNCS: plot_line(..., fig_size=(4.8, 2.8))
|
|
390
|
+
configure_plot_style(layout="paper-2col", font="helvetica", font_size=7) # Nature
|
|
391
|
+
```
|
|
392
|
+
|
|
299
393
|
### Consistent Series Styles
|
|
300
394
|
|
|
301
395
|
Give each method one color, marker, and bar pattern for the whole paper:
|
|
@@ -427,13 +521,14 @@ Available fonts:
|
|
|
427
521
|
from acadplot import available_fonts
|
|
428
522
|
|
|
429
523
|
print(available_fonts())
|
|
430
|
-
# ("libertine", "inconsolata", "times", "helvetica", "serif", "sans")
|
|
524
|
+
# ("libertine", "inconsolata", "times", "helvetica", "computer-modern", "serif", "sans")
|
|
431
525
|
```
|
|
432
526
|
|
|
433
|
-
The default `
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
`
|
|
527
|
+
The default `colorblind` theme uses the Okabe-Ito palette, which stays
|
|
528
|
+
distinguishable for the most common forms of color blindness, in print, and on
|
|
529
|
+
projectors. Use `theme="classic"` for a quieter, muted palette inspired by Paul
|
|
530
|
+
Tol's qualitative schemes, `mono` for grayscale-only venues, and `warm` for
|
|
531
|
+
slides.
|
|
437
532
|
|
|
438
533
|
Use a temporary style override when needed:
|
|
439
534
|
|
|
@@ -48,9 +48,11 @@ The examples use the bundled fonts, so regenerating them needs no TeX installati
|
|
|
48
48
|
|
|
49
49
|
### Fonts and Series Styles
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
Each font preset with the venues it suits (see
|
|
52
|
+
[Choosing a Style for Your Venue](#choosing-a-style-for-your-venue)),
|
|
53
|
+
rendered with no TeX:
|
|
52
54
|
|
|
53
|
-
<img src="https://raw.githubusercontent.com/sudip-bhujel/acadplot/main/examples/
|
|
55
|
+
<img src="https://raw.githubusercontent.com/sudip-bhujel/acadplot/main/examples/venue_gallery.png" width="600">
|
|
54
56
|
|
|
55
57
|
`series_styles` keeps each method's color, marker, and hatch the same across
|
|
56
58
|
plot types:
|
|
@@ -61,13 +63,13 @@ plot types:
|
|
|
61
63
|
|
|
62
64
|
The examples cover all built-in themes and layout profiles:
|
|
63
65
|
|
|
64
|
-
- `
|
|
65
|
-
- `
|
|
66
|
-
- `nature` with `paper-1col`: bar plot
|
|
67
|
-
- `colorblind` with `paper-2col`: grouped bar plot for one column in a two-column paper
|
|
66
|
+
- `colorblind` (default) with `paper-1col`: line plot
|
|
67
|
+
- `colorblind` with `paper-2col`: compact monospace line plot and grouped bar plot for one column in a two-column paper
|
|
68
68
|
- `colorblind` with `paper-2col-subplot`: two small subplots inside one column of a two-column paper
|
|
69
|
+
- `nature` with `paper-1col`: bar plot
|
|
69
70
|
- `mono` with `paper-1col`: stacked bar plot
|
|
70
71
|
- `warm` with `presentation`: presentation-scale line plot
|
|
72
|
+
- all five themes, including `classic`: style gallery
|
|
71
73
|
|
|
72
74
|
<img src="https://raw.githubusercontent.com/sudip-bhujel/acadplot/main/examples/presentation_style.png" width="500">
|
|
73
75
|
|
|
@@ -247,6 +249,7 @@ built-in math rendering.
|
|
|
247
249
|
| `libertine` | ACM (`acmart`) body text | Libertinus Serif (bundled) | `libertine`, `newtxmath` |
|
|
248
250
|
| `times` | IEEE and most ML conference templates | STIXGeneral (ships with Matplotlib) | `newtxtext`, `newtxmath` |
|
|
249
251
|
| `helvetica` | journals that ask for sans-serif, such as Nature and Science | Arimo (bundled, Arial-compatible) | `helvet`, `mathastext` |
|
|
252
|
+
| `computer-modern` | Springer LNCS, Elsevier, plain LaTeX | Computer Modern (ships with Matplotlib) | none (the LaTeX default) |
|
|
250
253
|
|
|
251
254
|
```python
|
|
252
255
|
configure_plot_style(layout="paper-2col", theme="classic", font="times")
|
|
@@ -254,8 +257,9 @@ configure_plot_style(layout="paper-2col", theme="classic", font="times")
|
|
|
254
257
|
|
|
255
258
|
Each preset sets tick numbers in its own text font. Inconsolata has no matching
|
|
256
259
|
math font, so Greek letters and math symbols in labels (such as `$\alpha$`)
|
|
257
|
-
still render in a serif math font.
|
|
258
|
-
|
|
260
|
+
still render in a serif math font. Matplotlib's Computer Modern has no bold
|
|
261
|
+
face in the same family, so bold text such as panel labels renders in regular
|
|
262
|
+
weight. `serif` and `sans` remain as aliases of `times` and `helvetica`.
|
|
259
263
|
|
|
260
264
|
For two subplots inside one column of a two-column paper, let the layout drive
|
|
261
265
|
the figure size:
|
|
@@ -281,6 +285,96 @@ fig.subplots_adjust(left=0.14, right=0.99, bottom=0.24, top=0.86, wspace=0.18)
|
|
|
281
285
|
save(fig, "one_column_two_panel.pdf", tight_layout=False)
|
|
282
286
|
```
|
|
283
287
|
|
|
288
|
+
### Choosing a Style for Your Venue
|
|
289
|
+
|
|
290
|
+
Match the figure font to the paper's body text and draw the figure at the width
|
|
291
|
+
it will be printed, so point sizes in the PDF are the sizes readers see. Where a
|
|
292
|
+
column is narrower than `paper-2col` (3.35 in), the table gives a `fig_size` to
|
|
293
|
+
pass to each plot call.
|
|
294
|
+
|
|
295
|
+
**Security conferences**
|
|
296
|
+
|
|
297
|
+
| Venue | Template and body font | `font=` | One-column figure | Full-width figure |
|
|
298
|
+
|---|---|---|---|---|
|
|
299
|
+
| IEEE S&P | `IEEEtran`, Times | `"times"` | `paper-2col` (column 3.49 in) | `paper-2col-span` (7.14 in) |
|
|
300
|
+
| USENIX Security | `usenix-2020-09`, Times | `"times"` | `paper-2col` (column 3.33 in) | `paper-2col-span` (7.0 in) |
|
|
301
|
+
| ACM CCS | `acmart` `sigconf`, Libertine | `"libertine"` | `paper-2col` (column 3.33 in) | `paper-2col-span` (7.01 in) |
|
|
302
|
+
| NDSS | IEEE conference template, Times | `"times"` | `paper-2col` (column 3.49 in) | `paper-2col-span` (7.14 in) |
|
|
303
|
+
|
|
304
|
+
**Machine learning conferences**
|
|
305
|
+
|
|
306
|
+
| Venue | Template and body font | `font=` | One-column figure | Full-width figure |
|
|
307
|
+
|---|---|---|---|---|
|
|
308
|
+
| NeurIPS | NeurIPS style, Times | `"times"` | single column | `paper-1col` (5.5 in) |
|
|
309
|
+
| ICLR | ICLR style, Times | `"times"` | single column | `paper-1col` (5.5 in) |
|
|
310
|
+
| ICML | ICML style, Times | `"times"` | `fig_size=(3.25, 2.1)` (column 3.25 in) | `fig_size=(6.7, 2.8)` (6.75 in) |
|
|
311
|
+
| CVPR, ICCV | CVPR author kit, Times | `"times"` | `fig_size=(3.25, 2.1)` (column 3.28 in) | `paper-2col-span` (6.875 in) |
|
|
312
|
+
| ECCV | Springer LNCS, Computer Modern | `"computer-modern"` | single column | `fig_size=(4.8, 2.8)` (4.8 in) |
|
|
313
|
+
| ACL, EMNLP, NAACL | ACL style, Times | `"times"` | `fig_size=(3.0, 1.95)` (column 3.03 in) | `fig_size=(6.3, 2.6)` (6.3 in) |
|
|
314
|
+
| AAAI | AAAI style, Times | `"times"` | `paper-2col` | `paper-2col-span` |
|
|
315
|
+
| KDD | `acmart` `sigconf`, Libertine | `"libertine"` | `paper-2col` (column 3.33 in) | `paper-2col-span` (7.01 in) |
|
|
316
|
+
|
|
317
|
+
**Journals and other venues**
|
|
318
|
+
|
|
319
|
+
| Venue | Body font | `font=` | One-column figure | Full-width figure |
|
|
320
|
+
|---|---|---|---|---|
|
|
321
|
+
| IEEE Transactions | Times | `"times"` | `paper-2col` (column 3.49 in) | `paper-2col-span` (7.14 in) |
|
|
322
|
+
| Nature, Science, Cell | journals ask for sans-serif figure text | `"helvetica"`; for Nature add `font_size=7` (5–7 pt) | `paper-2col` (Nature: 89 mm) | `paper-2col-span` (Nature: 183 mm) |
|
|
323
|
+
| Springer LNCS, Elsevier `elsarticle`, plain LaTeX, theses | Computer Modern | `"computer-modern"` | single column | `fig_size=(4.8, 2.8)` (LNCS: 4.8 in) |
|
|
324
|
+
| Slides | — | `"helvetica"` | — | `presentation` |
|
|
325
|
+
|
|
326
|
+
On ACM venues, `font="inconsolata"` (the default) matches `acmart`'s code font
|
|
327
|
+
if you prefer a code-style look. Templates and journal rules change, so check
|
|
328
|
+
the current author guide. A few rules hold everywhere:
|
|
329
|
+
|
|
330
|
+
- Include the PDF at its natural size, `\includegraphics{figure.pdf}` without a
|
|
331
|
+
`width=`, so text keeps the size AcadPlot set. Scaling a figure to fit also
|
|
332
|
+
scales its text.
|
|
333
|
+
- Pass the same `fig_size=` to every plot call in a paper, or to
|
|
334
|
+
`plt.subplots(figsize=...)` for figures you build yourself.
|
|
335
|
+
- `fig_size` changes only the canvas; text keeps the layout's font sizes.
|
|
336
|
+
|
|
337
|
+
Example: a one-column figure for an IEEE S&P paper.
|
|
338
|
+
|
|
339
|
+
```python
|
|
340
|
+
from acadplot import configure_plot_style, plot_line, save
|
|
341
|
+
|
|
342
|
+
configure_plot_style(layout="paper-2col", font="times")
|
|
343
|
+
|
|
344
|
+
fig, _ = plot_line(
|
|
345
|
+
[
|
|
346
|
+
([1, 2, 3, 4, 5], [76.0, 79.5, 82.0, 83.0, 84.0], "Ours"),
|
|
347
|
+
([1, 2, 3, 4, 5], [74.0, 77.0, 79.0, 80.5, 81.5], "Baseline"),
|
|
348
|
+
],
|
|
349
|
+
location="lower right",
|
|
350
|
+
label=("Training budget", "Accuracy (%)"),
|
|
351
|
+
)
|
|
352
|
+
save(fig, "accuracy.pdf")
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
```latex
|
|
356
|
+
\begin{figure}
|
|
357
|
+
\centering
|
|
358
|
+
\includegraphics{accuracy.pdf}
|
|
359
|
+
\caption{Accuracy versus training budget.}
|
|
360
|
+
\end{figure}
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
<img src="https://raw.githubusercontent.com/sudip-bhujel/acadplot/main/examples/venue_ieee.png" width="335">
|
|
364
|
+
|
|
365
|
+
For other venues, change the style line and add `fig_size=` where the table
|
|
366
|
+
lists one:
|
|
367
|
+
|
|
368
|
+
```python
|
|
369
|
+
configure_plot_style(layout="paper-2col", font="times") # IEEE S&P, USENIX, NDSS, AAAI
|
|
370
|
+
configure_plot_style(layout="paper-2col", font="libertine") # ACM CCS, KDD
|
|
371
|
+
configure_plot_style(layout="paper-1col", font="times") # NeurIPS, ICLR
|
|
372
|
+
configure_plot_style(layout="paper-2col", font="times") # ICML, CVPR: plot_line(..., fig_size=(3.25, 2.1))
|
|
373
|
+
configure_plot_style(layout="paper-2col", font="times") # ACL, EMNLP: plot_line(..., fig_size=(3.0, 1.95))
|
|
374
|
+
configure_plot_style(layout="paper-1col", font="computer-modern") # ECCV, LNCS: plot_line(..., fig_size=(4.8, 2.8))
|
|
375
|
+
configure_plot_style(layout="paper-2col", font="helvetica", font_size=7) # Nature
|
|
376
|
+
```
|
|
377
|
+
|
|
284
378
|
### Consistent Series Styles
|
|
285
379
|
|
|
286
380
|
Give each method one color, marker, and bar pattern for the whole paper:
|
|
@@ -412,13 +506,14 @@ Available fonts:
|
|
|
412
506
|
from acadplot import available_fonts
|
|
413
507
|
|
|
414
508
|
print(available_fonts())
|
|
415
|
-
# ("libertine", "inconsolata", "times", "helvetica", "serif", "sans")
|
|
509
|
+
# ("libertine", "inconsolata", "times", "helvetica", "computer-modern", "serif", "sans")
|
|
416
510
|
```
|
|
417
511
|
|
|
418
|
-
The default `
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
`
|
|
512
|
+
The default `colorblind` theme uses the Okabe-Ito palette, which stays
|
|
513
|
+
distinguishable for the most common forms of color blindness, in print, and on
|
|
514
|
+
projectors. Use `theme="classic"` for a quieter, muted palette inspired by Paul
|
|
515
|
+
Tol's qualitative schemes, `mono` for grayscale-only venues, and `warm` for
|
|
516
|
+
slides.
|
|
422
517
|
|
|
423
518
|
Use a temporary style override when needed:
|
|
424
519
|
|
|
@@ -74,6 +74,8 @@ class FontPreset:
|
|
|
74
74
|
latex_packages: tuple[str, ...]
|
|
75
75
|
# Matplotlib mathtext set for $...$ without TeX; "custom" uses the preset font.
|
|
76
76
|
mathtext_fontset: str = "custom"
|
|
77
|
+
# Format tick labels as math, for fonts without a Unicode minus sign.
|
|
78
|
+
mathtext_ticks: bool = False
|
|
77
79
|
|
|
78
80
|
|
|
79
81
|
BASE_COLORS = {
|
|
@@ -422,6 +424,18 @@ FONTS = {
|
|
|
422
424
|
),
|
|
423
425
|
latex_packages=("helvet.sty", "mathastext.sty"),
|
|
424
426
|
),
|
|
427
|
+
# Computer Modern ships with Matplotlib. cmr10 has no Unicode minus sign, so
|
|
428
|
+
# tick labels go through mathtext to get one.
|
|
429
|
+
"computer-modern": FontPreset(
|
|
430
|
+
family="serif",
|
|
431
|
+
serif=("cmr10", "DejaVu Serif"),
|
|
432
|
+
sans_serif=("cmss10", "DejaVu Sans"),
|
|
433
|
+
monospace=("cmtt10", "DejaVu Sans Mono"),
|
|
434
|
+
latex_preamble="",
|
|
435
|
+
latex_packages=(),
|
|
436
|
+
mathtext_fontset="cm",
|
|
437
|
+
mathtext_ticks=True,
|
|
438
|
+
),
|
|
425
439
|
}
|
|
426
440
|
# Older preset names, kept so existing calls keep working.
|
|
427
441
|
FONTS["serif"] = FONTS["times"]
|
|
@@ -638,7 +652,7 @@ def _latex_available(font: str) -> bool:
|
|
|
638
652
|
return True
|
|
639
653
|
|
|
640
654
|
|
|
641
|
-
_CURRENT_STYLE = _build_style("paper-1col", "
|
|
655
|
+
_CURRENT_STYLE = _build_style("paper-1col", "colorblind", "inconsolata", False)
|
|
642
656
|
|
|
643
657
|
|
|
644
658
|
def available_layouts() -> tuple[str, ...]:
|
|
@@ -707,6 +721,7 @@ def _apply_rcparams(style: dict[str, object]) -> None:
|
|
|
707
721
|
"mathtext.rm": primary_font,
|
|
708
722
|
"mathtext.it": f"{primary_font}:italic",
|
|
709
723
|
"mathtext.bf": f"{primary_font}:bold",
|
|
724
|
+
"axes.formatter.use_mathtext": font.mathtext_ticks,
|
|
710
725
|
"font.family": font.family,
|
|
711
726
|
"font.serif": list(font.serif),
|
|
712
727
|
"font.sans-serif": list(font.sans_serif),
|
|
@@ -755,7 +770,7 @@ def _apply_rcparams(style: dict[str, object]) -> None:
|
|
|
755
770
|
|
|
756
771
|
def configure_plot_style(
|
|
757
772
|
layout: str = "paper-1col",
|
|
758
|
-
theme: str = "
|
|
773
|
+
theme: str = "colorblind",
|
|
759
774
|
font: str = "inconsolata",
|
|
760
775
|
latex: LatexMode = False,
|
|
761
776
|
font_size: float | None = None,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|