Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:
run: uv python install 3.11
- name: Install project dependencies (including dev deps)
run: uv sync
- name: Install poppler-utils (for pdffonts)
run: sudo apt-get install -y poppler-utils
- name: Run tests
run: uv run pytest tests --cov --cov-report=xml
- name: Upload results to Codecov
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Agustinus' _Very_ Opiniated Publication-Ready Plotting Library
# A _Very_ Opiniated Publication-Ready Plotting Library

<div align="center">

Expand All @@ -18,7 +18,7 @@ advocate for the latter ([proof](https://agustinus.kristia.de/blog/plotting/)).

> [!IMPORTANT]
> Here's what I use now for all my publication needs. This library is designed to be
> _*very*_ opiniated. Beauty is in the eye of the beholder. Also, it is _very_ simple,
> **very** opiniated. Beauty is in the eye of the beholder. Also, it is _very_ simple,
> just a single file and that's it.

> [!NOTE]
Expand Down
6 changes: 6 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,9 @@ mypy:
lint:
make ruff
make mypy

build:
uv build

publish:
uv publish
1 change: 1 addition & 0 deletions pub_ready_plots/pub_ready_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ def get_mpl_rcParams(
"ytick.major.size": format.tick_size,
"xtick.major.width": format.tick_width,
"ytick.major.width": format.tick_width,
"pdf.fonttype": 42,
}

w = width_frac * (format.col_width if single_col else format.text_width)
Expand Down
23 changes: 23 additions & 0 deletions tests/test_core_func.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import subprocess
from pathlib import Path
from typing import Sequence

import matplotlib as plt
import numpy as np
import pytest

import pub_ready_plots as prp
Expand Down Expand Up @@ -75,3 +78,23 @@ def test_double_column(layout: prp.Layout) -> None:
_ = prp.get_mpl_rcParams(
width_frac=1, height_frac=0.1, layout=layout, single_col=True
)


@pytest.mark.parametrize("layout", LAYOUTS)
def test_no_type3_fonts(layout: prp.Layout, tmp_path: Path) -> None:
FNAME = "temp.pdf"

with prp.get_context(
width_frac=0.5,
height_frac=0.15,
layout=layout,
) as (fig, ax):
x = np.linspace(-1, 1)
fx = np.sin(x)
ax.plot(x, fx)
fig.savefig(FNAME)

result = subprocess.run(
["pdffonts", str(FNAME)], capture_output=True, text=True, check=True
)
assert "Type 3" not in result.stdout
Loading