Skip to content

Commit 594647b

Browse files
committed
Add support for pgf output
1 parent 8e43842 commit 594647b

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ Executes a plotting function and saves the resulting plot to specified formats u
270270
+----------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
271271
| ``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``. |
272272
+----------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
273-
| ``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". |
273+
| ``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". |
274274
+----------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
275275
| ``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). |
276276
+----------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
@@ -296,7 +296,7 @@ Environment Variables
296296

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

301301
Citing
302302
------

teeplot/teeplot.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def _is_running_on_ci() -> bool:
3636
save = {
3737
".eps": None,
3838
".pdf": True,
39+
".pgf": None,
3940
".png": True,
4041
".ps": None,
4142
".svg": None,
@@ -338,14 +339,16 @@ def save_callback():
338339
transparent=teeplot_transparent,
339340
dpi=teeplot_dpi,
340341
# see https://matplotlib.org/2.1.1/users/whats_new.html#reproducible-ps-pdf-and-svg-output
341-
metadata={
342-
key: None
343-
for key in {
344-
".png": [],
345-
".pdf": ["CreationDate"],
346-
".svg": ["Date"],
347-
}.get(ext, [])
348-
},
342+
**dict(
343+
metadata={
344+
key: None
345+
for key in {
346+
".png": [],
347+
".pdf": ["CreationDate"],
348+
".svg": ["Date"],
349+
}.get(ext, [])
350+
},
351+
) if ext != ".pgf" else {},
349352
)
350353

351354
if teeplot_show or (teeplot_show is None and hasattr(sys, 'ps1')):

tests/test_tee.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def test_oncollision_fix():
209209
)
210210

211211

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

215215
# adapted from https://seaborn.pydata.org/generated/seaborn.lineplot.html

0 commit comments

Comments
 (0)