diff --git a/README.md b/README.md index 74e817b..8befc74 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,6 @@ This tool helps visualize PresentMon logs. | -t | -Title | Set custom title which is shown at the top of generated image | | -b | -Bins | Defines how many bins should be used for histograms | | -d | -Theme | Lets you choose between dark and light mode. Default dark. Options: "dark", "light" | -| -s | -ShowWindow | If set shows a preview window of the graph (image still gets stored) | | -p | -Pdf | Exports the graph as a .pdf too | | -v | -Svg | Exports the graph as a .svg too | @@ -40,14 +39,20 @@ PresentMon-Grapher.exe -i "C:\presentmon-log.csv" -b 40 PresentMon-Grapher.exe -i "C:\presentmon-log.csv" -d light ``` -### Show Preview Window +### Export PDF too ```cmd -PresentMon-Grapher.exe -i "C:\presentmon-log.csv" -s +PresentMon-Grapher.exe -i "C:\presentmon-log.csv" -p +``` + +### Export SVG too + +```cmd +PresentMon-Grapher.exe -i "C:\presentmon-log.csv" -v ``` ### All Options Combined ```cmd -PresentMon-Grapher.exe -i "C:\presentmon-log.csv" -o "C:\presentmon-log.png" -b 40 -d light -s +PresentMon-Grapher.exe -i "C:\presentmon-log.csv" -o "C:\presentmon-log.png" -b 40 -d light -p -v ``` diff --git a/presentmon-graph.py b/presentmon-graph.py index e56a87c..453777f 100644 --- a/presentmon-graph.py +++ b/presentmon-graph.py @@ -1,9 +1,13 @@ import matplotlib.pyplot as plt +import matplotlib.backends.backend_cairo import numpy as np import pandas as pd import argparse import os from pathlib import Path +from matplotlib import use as mpluse + +mpluse("Cairo") # Defaults inputFilename = "input.csv" @@ -16,7 +20,6 @@ parser.add_argument("-t", "--Title", help = "Graph title shown at the top of generated image.") parser.add_argument("-b", "--Bins", help = "How many bins should be used for histograms. Default 20", default=20, type=int) parser.add_argument("-d", "--Theme", help = "Switch between light and dark mode. Default 'dark'", choices=['dark', 'light'], default="dark") -parser.add_argument("-s", "--ShowWindow", help = "Enable a window whichs shows the generated graph on screen.", action='store_true') parser.add_argument("-p", "--Pdf", help = "Exports the graph as a .pdf too", action='store_true') parser.add_argument("-v", "--Svg", help = "Exports the graph as a .svg too", action='store_true') args = parser.parse_args() @@ -166,10 +169,6 @@ def main(): print("All Done!") - # Show windows if enabled - if args.ShowWindow: - plt.show() - def movingaverage(interval, window_size): diff --git a/requirements.txt b/requirements.txt index 970f9eb..ba49c9a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,6 @@ matplotlib==3.7.2 numpy==1.26.0 pandas==2.1.1 +pycairo==1.26.0 +CairoSVG==2.6.0 +cairocffi==1.6.1 \ No newline at end of file