diff --git a/.ci.yml b/.ci.yml index 74cd943..e716950 100644 --- a/.ci.yml +++ b/.ci.yml @@ -25,7 +25,7 @@ simple_test: - sargraph chart stop - cd .. - - cat plot.txt + - cat plot.plot.txt - test -f plot.svg artifacts: when: always diff --git a/graph.py b/graph.py index 0427b42..ad1774c 100644 --- a/graph.py +++ b/graph.py @@ -16,6 +16,7 @@ import numpy as np from typing import List, Tuple, Optional from contextlib import redirect_stdout from common import * +from pathlib import Path global gnuplot @@ -383,7 +384,7 @@ def create_ascii_plot( def render_ascii_plot( - outpath: str, + outpath: Path, summary: str, titles: List, xtitles: List, @@ -402,9 +403,10 @@ def render_ascii_plot( axes_color='black', ticks_color='white'): - print(summary) + print(f'Saving to {outpath}') with open(outpath, 'w') as outfile: with redirect_stdout(outfile): + print(summary) for title, xtitle, xunit, ytitle, yunit, ydata in zip(titles, xtitles, xunits, ytitles, yunits, ydatas): # noqa: E501 print('\n\n') create_ascii_plot( @@ -447,7 +449,7 @@ def ascii_graph(session, fname='plot.png'): summary += f"Duration: {START_DATE} .. {END_DATE} ({DURATION})" render_ascii_plot( - f'{fname}.txt', + f'{Path(fname).with_suffix(".plot.txt")}', summary, titles, ["time", "time", "time"],