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
44 changes: 33 additions & 11 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,39 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions
- name: Test with tox
run: tox
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions

# Install TeX distribution for PGF output from matplotlib
- name: Install TeX distribution for PGF output (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y texlive-latex-extra texlive-xetex

- name: Install TeX distribution for PGF output (Windows)
if: runner.os == 'Windows'
run: |
choco install miktex -y
echo "C:\Program Files\MiKTeX\miktex\bin\x64" >> $env:GITHUB_PATH

- name: Install TeX distribution for PGF output (macOS)
if: runner.os == 'macOS'
run: |
brew install --cask mactex-no-gui
echo "/Library/TeX/texbin" >> $GITHUB_PATH

- name: Test with tox
run: tox

deploy:
needs: build
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ Executes a plotting function and saves the resulting plot to specified formats u
+----------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| ``teeplot_postprocess`` | Actions to perform after plotting but before saving. Can be a string of code to ``exec`` or a callable function. If a string, it's executed with access to ``plt`` and ``sns`` (if installed), and the plotter return value as ``teed``. |
+----------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| ``teeplot_save`` | File formats to save the plots in. Defaults to global settings if ``True``, all output suppressed if ``False``. Default global setting is ``{" .png", ".pdf"}``. Supported: ".eps", ".png", ".pdf", ".ps", ".svg". |
| ``teeplot_save`` | File formats to save the plots in. Defaults to global settings if ``True``, all output suppressed if ``False``. Default global setting is ``{" .png", ".pdf"}``. Supported: ".eps", ".png", ".pdf", ".pgf", ".ps", ".svg". |
+----------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| ``teeplot_show`` | Dictates whether ``plt.show()`` should be called after plot is saved. If True, the plot is displayed using ``plt.show()``. Default behavior is to display if an interactive environment is detected (e.g., a notebook). |
+----------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Expand All @@ -296,7 +296,7 @@ Environment Variables

- ``TEEPLOT_ONCOLLISION``: Configures the default collision handling strategy. See ``teeplot_oncollision`` kwarg
- ``TEEPLOT_DRAFTMODE``: If set, enables draft mode globally.
- ``TEEPLOT_<FORMAT>``: Boolean flags that determine default behavior for each format (e.g., ``EPS``, ``PNG``, ``PDF``, ``PS``, ``SVG``); "defer" defers to call kwargs.
- ``TEEPLOT_<FORMAT>``: Boolean flags that determine default behavior for each format (e.g., ``EPS``, ``PNG``, ``PDF``, ``PGF``, ``PS``, ``SVG``); "defer" defers to call kwargs.

Citing
------
Expand Down
19 changes: 11 additions & 8 deletions teeplot/teeplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def _is_running_on_ci() -> bool:
save = {
".eps": None,
".pdf": True,
".pgf": None,
".png": True,
".ps": None,
".svg": None,
Expand Down Expand Up @@ -338,14 +339,16 @@ def save_callback():
transparent=teeplot_transparent,
dpi=teeplot_dpi,
# see https://matplotlib.org/2.1.1/users/whats_new.html#reproducible-ps-pdf-and-svg-output
metadata={
key: None
for key in {
".png": [],
".pdf": ["CreationDate"],
".svg": ["Date"],
}.get(ext, [])
},
**dict(
metadata={
key: None
for key in {
".png": [],
".pdf": ["CreationDate"],
".svg": ["Date"],
}.get(ext, [])
},
) if ext != ".pgf" else {},
)

if teeplot_show or (teeplot_show is None and hasattr(sys, 'ps1')):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_tee.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def test_oncollision_fix():
)


@pytest.mark.parametrize("format", [".png", ".pdf", ".ps", ".eps", ".svg"])
@pytest.mark.parametrize("format", [".png", ".pdf", ".pgf", ".ps", ".eps", ".svg"])
def test_outformat(format):

# adapted from https://seaborn.pydata.org/generated/seaborn.lineplot.html
Expand Down
Loading