acadplot 0.1.2__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.1.2/README.md → acadplot-0.3.0/PKG-INFO +248 -53
- acadplot-0.1.2/PKG-INFO → acadplot-0.3.0/README.md +233 -65
- acadplot-0.3.0/pyproject.toml +23 -0
- acadplot-0.1.2/pyproject.toml → acadplot-0.3.0/pyproject.toml.orig +3 -3
- {acadplot-0.1.2 → acadplot-0.3.0}/src/acadplot/__init__.py +1 -1
- acadplot-0.3.0/src/acadplot/bar.py +296 -0
- {acadplot-0.1.2 → acadplot-0.3.0}/src/acadplot/charts.py +107 -164
- acadplot-0.3.0/src/acadplot/draw.py +229 -0
- acadplot-0.3.0/src/acadplot/fonts/Arimo-Bold.ttf +0 -0
- acadplot-0.3.0/src/acadplot/fonts/Arimo-Italic.ttf +0 -0
- acadplot-0.3.0/src/acadplot/fonts/Arimo-Regular.ttf +0 -0
- acadplot-0.3.0/src/acadplot/fonts/Inconsolatazi4-Bold.otf +0 -0
- acadplot-0.3.0/src/acadplot/fonts/Inconsolatazi4-Regular.otf +0 -0
- acadplot-0.3.0/src/acadplot/fonts/LICENSE-Apache-2.0.txt +202 -0
- acadplot-0.3.0/src/acadplot/fonts/LICENSE-Inconsolata-OFL.txt +92 -0
- acadplot-0.3.0/src/acadplot/fonts/LICENSE-Libertinus-OFL.txt +94 -0
- acadplot-0.3.0/src/acadplot/fonts/LibertinusSerif-Bold.otf +0 -0
- acadplot-0.3.0/src/acadplot/fonts/LibertinusSerif-Italic.otf +0 -0
- acadplot-0.3.0/src/acadplot/fonts/LibertinusSerif-Regular.otf +0 -0
- acadplot-0.3.0/src/acadplot/fonts/README.md +17 -0
- acadplot-0.3.0/src/acadplot/line.py +85 -0
- acadplot-0.3.0/src/acadplot/plot.py +3 -0
- {acadplot-0.1.2 → acadplot-0.3.0}/src/acadplot/styles.py +105 -22
- {acadplot-0.1.2 → acadplot-0.3.0}/src/acadplot/utils.py +11 -24
- acadplot-0.1.2/src/acadplot/bar.py +0 -428
- acadplot-0.1.2/src/acadplot/draw.py +0 -126
- acadplot-0.1.2/src/acadplot/line.py +0 -184
- acadplot-0.1.2/src/acadplot/plot.py +0 -70
- {acadplot-0.1.2 → acadplot-0.3.0}/LICENSE +0 -0
|
@@ -1,8 +1,23 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: acadplot
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: A simple plotting tool using matplotlib for generating plots and subplots for research papers.
|
|
5
|
+
Author: Sudip Bhujel
|
|
6
|
+
Author-email: Sudip Bhujel <code@sudipbhujel.com.np>
|
|
7
|
+
License-Expression: MIT AND OFL-1.1 AND Apache-2.0
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
License-File: src/acadplot/fonts/LICENSE-Apache-2.0.txt
|
|
10
|
+
License-File: src/acadplot/fonts/LICENSE-Inconsolata-OFL.txt
|
|
11
|
+
License-File: src/acadplot/fonts/LICENSE-Libertinus-OFL.txt
|
|
12
|
+
Requires-Dist: matplotlib>=3.10.8
|
|
13
|
+
Requires-Python: >=3.12
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
|
|
1
16
|
# AcadPlot
|
|
2
17
|
|
|
3
18
|
A simple plotting tool using matplotlib for generating publication-quality plots and subplots for research papers.
|
|
4
19
|
|
|
5
|
-
AcadPlot defaults to an academic Inconsolata-style setup
|
|
20
|
+
AcadPlot defaults to an academic Inconsolata-style setup. It bundles its fonts and needs no TeX installation; LaTeX rendering is optional.
|
|
6
21
|
|
|
7
22
|
## Examples
|
|
8
23
|
|
|
@@ -12,7 +27,7 @@ Regenerate every example from source with:
|
|
|
12
27
|
uv run python examples/generate_examples.py
|
|
13
28
|
```
|
|
14
29
|
|
|
15
|
-
The
|
|
30
|
+
The examples use the bundled fonts, so regenerating them needs no TeX installation.
|
|
16
31
|
|
|
17
32
|
### Core Figures
|
|
18
33
|
|
|
@@ -46,17 +61,30 @@ The committed examples use LaTeX Inconsolata; regeneration requires a TeX instal
|
|
|
46
61
|
|
|
47
62
|
<img src="https://raw.githubusercontent.com/sudip-bhujel/acadplot/main/examples/utility_panel.png" width="500">
|
|
48
63
|
|
|
64
|
+
### Fonts and Series Styles
|
|
65
|
+
|
|
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:
|
|
69
|
+
|
|
70
|
+
<img src="https://raw.githubusercontent.com/sudip-bhujel/acadplot/main/examples/venue_gallery.png" width="600">
|
|
71
|
+
|
|
72
|
+
`series_styles` keeps each method's color, marker, and hatch the same across
|
|
73
|
+
plot types:
|
|
74
|
+
|
|
75
|
+
<img src="https://raw.githubusercontent.com/sudip-bhujel/acadplot/main/examples/series_styles.png" width="500">
|
|
76
|
+
|
|
49
77
|
### Style Coverage
|
|
50
78
|
|
|
51
79
|
The examples cover all built-in themes and layout profiles:
|
|
52
80
|
|
|
53
|
-
- `
|
|
54
|
-
- `
|
|
55
|
-
- `nature` with `paper-1col`: bar plot
|
|
56
|
-
- `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
|
|
57
83
|
- `colorblind` with `paper-2col-subplot`: two small subplots inside one column of a two-column paper
|
|
84
|
+
- `nature` with `paper-1col`: bar plot
|
|
58
85
|
- `mono` with `paper-1col`: stacked bar plot
|
|
59
86
|
- `warm` with `presentation`: presentation-scale line plot
|
|
87
|
+
- all five themes, including `classic`: style gallery
|
|
60
88
|
|
|
61
89
|
<img src="https://raw.githubusercontent.com/sudip-bhujel/acadplot/main/examples/presentation_style.png" width="500">
|
|
62
90
|
|
|
@@ -71,7 +99,7 @@ The examples cover all built-in themes and layout profiles:
|
|
|
71
99
|
- 🎨 Pre-defined color schemes optimized for academic publications
|
|
72
100
|
- 🖋️ Theme-controlled axis, tick, and legend colors for consistent figures
|
|
73
101
|
- 🔷 Multiple marker styles for distinguishing data series
|
|
74
|
-
- 📐
|
|
102
|
+
- 📐 Math notation without TeX, with optional LaTeX rendering
|
|
75
103
|
- 🔧 Customizable plot elements (ticks, grids, legends)
|
|
76
104
|
- 📈 Line, bar, scatter, error-bar, box, and heatmap chart helpers
|
|
77
105
|
- 💾 Publication-safe `save()` utility for PNG, PDF, and SVG output
|
|
@@ -105,6 +133,7 @@ pip install -e .
|
|
|
105
133
|
|
|
106
134
|
- Python >= 3.12
|
|
107
135
|
- matplotlib >= 3.10.8
|
|
136
|
+
- No TeX installation needed (optional, for `latex=True`)
|
|
108
137
|
|
|
109
138
|
## Usage
|
|
110
139
|
|
|
@@ -220,16 +249,33 @@ Layout defaults:
|
|
|
220
249
|
| `presentation` | `7.2 x 4.2 in` | large labels and heavier marks | slides and talks |
|
|
221
250
|
|
|
222
251
|
`paper-2col-subplot` intentionally uses smaller tick labels than axis labels:
|
|
223
|
-
`tick_size=
|
|
252
|
+
`tick_size=5.5`, `legend_size=5.5`, `label_size=5.8`, and `title_size=5.8`.
|
|
224
253
|
This keeps dense two-panel figures legible without letting x/y tick labels
|
|
225
254
|
dominate the plot area.
|
|
226
255
|
|
|
227
|
-
|
|
256
|
+
Pick the font preset that matches the paper's body text. Every preset works
|
|
257
|
+
without TeX or system fonts: AcadPlot bundles the font files (licenses in
|
|
258
|
+
[`src/acadplot/fonts`](src/acadplot/fonts/README.md)) and uses Matplotlib's
|
|
259
|
+
built-in math rendering.
|
|
260
|
+
|
|
261
|
+
| Preset | Matches | Font used | LaTeX packages (`latex=True`) |
|
|
262
|
+
|---|---|---|---|
|
|
263
|
+
| `inconsolata` (default) | ACM's code font; a monospace look | Inconsolatazi4 (bundled) | `zi4`, `mathastext` |
|
|
264
|
+
| `libertine` | ACM (`acmart`) body text | Libertinus Serif (bundled) | `libertine`, `newtxmath` |
|
|
265
|
+
| `times` | IEEE and most ML conference templates | STIXGeneral (ships with Matplotlib) | `newtxtext`, `newtxmath` |
|
|
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) |
|
|
228
268
|
|
|
229
269
|
```python
|
|
230
|
-
configure_plot_style(layout="paper-2col", theme="classic", font="
|
|
270
|
+
configure_plot_style(layout="paper-2col", theme="classic", font="times")
|
|
231
271
|
```
|
|
232
272
|
|
|
273
|
+
Each preset sets tick numbers in its own text font. Inconsolata has no matching
|
|
274
|
+
math font, so Greek letters and math symbols in labels (such as `$\alpha$`)
|
|
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`.
|
|
278
|
+
|
|
233
279
|
For two subplots inside one column of a two-column paper, let the layout drive
|
|
234
280
|
the figure size:
|
|
235
281
|
|
|
@@ -254,6 +300,118 @@ fig.subplots_adjust(left=0.14, right=0.99, bottom=0.24, top=0.86, wspace=0.18)
|
|
|
254
300
|
save(fig, "one_column_two_panel.pdf", tight_layout=False)
|
|
255
301
|
```
|
|
256
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
|
+
|
|
393
|
+
### Consistent Series Styles
|
|
394
|
+
|
|
395
|
+
Give each method one color, marker, and bar pattern for the whole paper:
|
|
396
|
+
|
|
397
|
+
```python
|
|
398
|
+
configure_plot_style(
|
|
399
|
+
layout="paper-2col",
|
|
400
|
+
series_styles={
|
|
401
|
+
"Ours": {"color": "red", "marker": "circle"},
|
|
402
|
+
"Baseline": {"color": "gray", "marker": "square", "pattern": "diagonal"},
|
|
403
|
+
},
|
|
404
|
+
)
|
|
405
|
+
|
|
406
|
+
plot_line([(x, y_ours, "Ours"), (x, y_base, "Baseline")])
|
|
407
|
+
plot_grouped_bar(datasets, [(acc_ours, "Ours"), (acc_base, "Baseline")])
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
A color, marker, or pattern written in the data tuple still wins, and a
|
|
411
|
+
per-call `patterns=` argument beats a mapped pattern. Series without an entry
|
|
412
|
+
use the theme palette and marker cycle as before. Theme color names such as
|
|
413
|
+
`"red"` follow the active theme.
|
|
414
|
+
|
|
257
415
|
### Saving Figures
|
|
258
416
|
|
|
259
417
|
Plot functions save directly when `fname` is provided. For manual figures,
|
|
@@ -363,13 +521,14 @@ Available fonts:
|
|
|
363
521
|
from acadplot import available_fonts
|
|
364
522
|
|
|
365
523
|
print(available_fonts())
|
|
366
|
-
# ("libertine", "inconsolata", "serif", "sans")
|
|
524
|
+
# ("libertine", "inconsolata", "times", "helvetica", "computer-modern", "serif", "sans")
|
|
367
525
|
```
|
|
368
526
|
|
|
369
|
-
The default `
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
`
|
|
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.
|
|
373
532
|
|
|
374
533
|
Use a temporary style override when needed:
|
|
375
534
|
|
|
@@ -386,10 +545,13 @@ You can also override font size for one plot call:
|
|
|
386
545
|
plot_line(data, location="upper left", font_size=10.5, fname="column_plot.pdf")
|
|
387
546
|
```
|
|
388
547
|
|
|
389
|
-
|
|
548
|
+
LaTeX rendering is off by default, so figures look the same on every machine.
|
|
549
|
+
Pass `latex=True` to render text with a local TeX installation and the packages
|
|
550
|
+
listed in the font table, or `latex="auto"` to use LaTeX only when those are
|
|
551
|
+
available. With LaTeX on, escape `%` in labels as `\%`:
|
|
390
552
|
|
|
391
553
|
```python
|
|
392
|
-
configure_plot_style(layout="paper-2col", latex=
|
|
554
|
+
configure_plot_style(layout="paper-2col", latex=True)
|
|
393
555
|
```
|
|
394
556
|
|
|
395
557
|
### Basic Plot
|
|
@@ -401,6 +563,7 @@ configure_plot_style(layout="paper-1col", theme="classic")
|
|
|
401
563
|
|
|
402
564
|
# Define your data: (x_values, y_values, marker, label)
|
|
403
565
|
# Colors are optional; omitted colors use the active professional theme palette.
|
|
566
|
+
# Markers are optional too: (x_values, y_values, label) cycles distinct filled markers.
|
|
404
567
|
data = [
|
|
405
568
|
([10, 20, 30, 40, 50], [5, 10, 15, 20, 25], "x_filled", "Method A"),
|
|
406
569
|
([10, 20, 30, 40, 50], [6, 11, 14, 18, 22], "square", "Method B"),
|
|
@@ -415,7 +578,7 @@ plot_line(
|
|
|
415
578
|
grid="major",
|
|
416
579
|
ystart=0,
|
|
417
580
|
yticks=range(0, 30, 5),
|
|
418
|
-
fname="output.pdf"
|
|
581
|
+
fname="output.pdf",
|
|
419
582
|
)
|
|
420
583
|
```
|
|
421
584
|
|
|
@@ -437,7 +600,7 @@ plot_line(
|
|
|
437
600
|
location="upper left",
|
|
438
601
|
fig_size=(5, 3), # Custom figure size (width, height)
|
|
439
602
|
label=("X-axis Label", "Y-axis Label"),
|
|
440
|
-
fname="large_plot.pdf"
|
|
603
|
+
fname="large_plot.pdf",
|
|
441
604
|
)
|
|
442
605
|
```
|
|
443
606
|
|
|
@@ -484,13 +647,9 @@ data = [
|
|
|
484
647
|
|
|
485
648
|
fig, axes = plt.subplots(1, 2, figsize=(6, 2))
|
|
486
649
|
|
|
487
|
-
# Plot on each subplot
|
|
488
|
-
plot_line(data,
|
|
489
|
-
plot_line(data,
|
|
490
|
-
|
|
491
|
-
# Remove individual legends
|
|
492
|
-
axes[0].get_legend().remove()
|
|
493
|
-
axes[1].get_legend().remove()
|
|
650
|
+
# Plot on each subplot without per-panel legends
|
|
651
|
+
plot_line(data, location=None, ax=axes[0])
|
|
652
|
+
plot_line(data, location=None, ax=axes[1])
|
|
494
653
|
|
|
495
654
|
# Get handles and labels from one subplot
|
|
496
655
|
handles, labels = axes[0].get_legend_handles_labels()
|
|
@@ -533,7 +692,7 @@ plot_bar(
|
|
|
533
692
|
location="upper left",
|
|
534
693
|
label=("X-axis Label", "Y-axis Label"),
|
|
535
694
|
xticklabels=["Group A", "Group B", "Group C"],
|
|
536
|
-
fname="single_bar.pdf"
|
|
695
|
+
fname="single_bar.pdf",
|
|
537
696
|
)
|
|
538
697
|
```
|
|
539
698
|
|
|
@@ -544,17 +703,18 @@ from acadplot import plot_grouped_bar, configure_plot_style
|
|
|
544
703
|
|
|
545
704
|
configure_plot_style()
|
|
546
705
|
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
(
|
|
550
|
-
(
|
|
706
|
+
categories = ["Dataset A", "Dataset B", "Dataset C"]
|
|
707
|
+
series = [
|
|
708
|
+
([10, 15, 12], "Train"),
|
|
709
|
+
([8, 12, 14], "Val"),
|
|
551
710
|
]
|
|
552
711
|
|
|
553
712
|
plot_grouped_bar(
|
|
554
|
-
|
|
713
|
+
categories,
|
|
714
|
+
series,
|
|
555
715
|
location="upper left",
|
|
556
716
|
label=("X-axis Label", "Y-axis Label"),
|
|
557
|
-
fname="grouped_bar.pdf"
|
|
717
|
+
fname="grouped_bar.pdf",
|
|
558
718
|
)
|
|
559
719
|
```
|
|
560
720
|
|
|
@@ -574,10 +734,10 @@ print(available_patterns())
|
|
|
574
734
|
configure_plot_style(layout="paper-1col", theme="colorblind", text_color="dark")
|
|
575
735
|
|
|
576
736
|
plot_grouped_bar(
|
|
737
|
+
["Dataset A", "Dataset B", "Dataset C"],
|
|
577
738
|
[
|
|
578
|
-
(
|
|
579
|
-
(
|
|
580
|
-
("Dataset C", [(86.1, "Baseline"), (88.0, "AcadPlot")]),
|
|
739
|
+
([81.2, 84.4, 86.1], "Baseline"),
|
|
740
|
+
([83.5, 86.2, 88.0], "AcadPlot"),
|
|
581
741
|
],
|
|
582
742
|
location="upper left",
|
|
583
743
|
label=("Dataset", "Score"),
|
|
@@ -619,7 +779,7 @@ plot_stacked_bar(
|
|
|
619
779
|
stacks,
|
|
620
780
|
location="upper left",
|
|
621
781
|
label=("X-axis Label", "Y-axis Label"),
|
|
622
|
-
fname="stacked_bar.pdf"
|
|
782
|
+
fname="stacked_bar.pdf",
|
|
623
783
|
)
|
|
624
784
|
```
|
|
625
785
|
|
|
@@ -715,10 +875,25 @@ Available color names or indices (0-19):
|
|
|
715
875
|
|
|
716
876
|
```python
|
|
717
877
|
colors = {
|
|
718
|
-
"blue",
|
|
719
|
-
"
|
|
720
|
-
"
|
|
721
|
-
"
|
|
878
|
+
"blue",
|
|
879
|
+
"orange",
|
|
880
|
+
"green",
|
|
881
|
+
"purple",
|
|
882
|
+
"brown",
|
|
883
|
+
"yellow",
|
|
884
|
+
"sky_blue",
|
|
885
|
+
"gray",
|
|
886
|
+
"red",
|
|
887
|
+
"pink",
|
|
888
|
+
"teal",
|
|
889
|
+
"olive",
|
|
890
|
+
"navy",
|
|
891
|
+
"maroon",
|
|
892
|
+
"lime",
|
|
893
|
+
"cyan",
|
|
894
|
+
"magenta",
|
|
895
|
+
"dark_gray",
|
|
896
|
+
"light_gray",
|
|
722
897
|
}
|
|
723
898
|
```
|
|
724
899
|
|
|
@@ -728,12 +903,32 @@ Use marker names or indices (0-26):
|
|
|
728
903
|
|
|
729
904
|
```python
|
|
730
905
|
markers = {
|
|
731
|
-
"square",
|
|
732
|
-
"
|
|
733
|
-
"
|
|
734
|
-
"
|
|
735
|
-
"
|
|
736
|
-
"
|
|
906
|
+
"square",
|
|
907
|
+
"triangle_up",
|
|
908
|
+
"pentagon",
|
|
909
|
+
"circle",
|
|
910
|
+
"star",
|
|
911
|
+
"plus_filled",
|
|
912
|
+
"triangle_down",
|
|
913
|
+
"diamond",
|
|
914
|
+
"x_filled",
|
|
915
|
+
"triangle_left",
|
|
916
|
+
"triangle_right",
|
|
917
|
+
"thin_diamond",
|
|
918
|
+
"hexagon1",
|
|
919
|
+
"hexagon2",
|
|
920
|
+
"plus",
|
|
921
|
+
"x",
|
|
922
|
+
"vline",
|
|
923
|
+
"hline",
|
|
924
|
+
"point",
|
|
925
|
+
"pixel",
|
|
926
|
+
"tri_down",
|
|
927
|
+
"tri_up",
|
|
928
|
+
"tri_left",
|
|
929
|
+
"tri_right",
|
|
930
|
+
"octagon",
|
|
931
|
+
"none",
|
|
737
932
|
}
|
|
738
933
|
```
|
|
739
934
|
|
|
@@ -743,10 +938,10 @@ markers = {
|
|
|
743
938
|
|
|
744
939
|
**Parameters:**
|
|
745
940
|
|
|
746
|
-
- `lines` (List[Tuple]): List of lines to plot, each defined by `(x_values, y_values, marker, label)
|
|
747
|
-
- `location` (str): Location of the legend (e.g., "upper left", "lower right")
|
|
941
|
+
- `lines` (List[Tuple]): List of lines to plot, each defined by `(x_values, y_values, label)`, `(x_values, y_values, marker, label)`, or `(x_values, y_values, color, marker, label)`
|
|
942
|
+
- `location` (str | None): Location of the legend (e.g., "upper left", "lower right"). Default: `"best"`. Pass `None` for no legend; this works the same in every plot function
|
|
748
943
|
- `fig_size` (Tuple[float, float]): Figure size (width, height) in inches. Defaults to the active layout profile
|
|
749
|
-
- `label` (Tuple[str, str]): Labels for x and y axes. Default: `(
|
|
944
|
+
- `label` (Tuple[str, str]): Labels for x and y axes. Default: `None` (no labels)
|
|
750
945
|
- `ax` (Optional[plt.Axes]): Axes to plot on. Creates new if None
|
|
751
946
|
- `xticks` (Optional[List[float] | range]): Custom x-axis ticks
|
|
752
947
|
- `yticks` (Optional[List[float] | range]): Custom y-axis ticks
|
|
@@ -754,15 +949,15 @@ markers = {
|
|
|
754
949
|
- `ystart` (Optional[float]): Minimum y-axis value
|
|
755
950
|
- `font_size` (int): Font size for the plot. Defaults to the active layout profile
|
|
756
951
|
- `grid` (str): Grid preset: `"major-y"`, `"major"`, `"major-minor"`, or `"none"`
|
|
757
|
-
- `fname` (Optional[str]): Filename to save the plot. Default: `
|
|
952
|
+
- `fname` (Optional[str]): Filename to save the plot. Default: `None` (not saved)
|
|
758
953
|
|
|
759
954
|
### `draw(ax, x, y, color_key, marker_key, label)`
|
|
760
955
|
|
|
761
956
|
Draw a single line with markers on the given axes.
|
|
762
957
|
|
|
763
|
-
### `configure_plot_style(layout, theme, font, latex, font_size, label_size, tick_size, legend_size, title_size, scale, text_color)`
|
|
958
|
+
### `configure_plot_style(layout, theme, font, latex, font_size, label_size, tick_size, legend_size, title_size, scale, text_color, series_styles)`
|
|
764
959
|
|
|
765
|
-
Configure global plot style settings
|
|
960
|
+
Configure global plot style settings. Layouts and themes
|
|
766
961
|
are composable. Each layout has its own default figure size and typography, but
|
|
767
962
|
explicit `font_size`, `label_size`, `tick_size`, `legend_size`, and `title_size`
|
|
768
963
|
arguments always override those defaults. Use `text_color` as a universal text
|