diff options
author | Daniel Friesel <derf@finalrewind.org> | 2021-11-16 22:09:34 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2021-11-16 22:09:34 +0100 |
commit | 530110b84a74eaa97268566b760b041839a1515f (patch) | |
tree | 6b477f84c5711c04f9dbd712052e9bf17d1d763a | |
parent | 58fc39a8bf0123977cd89713fd64f0d3f52794ed (diff) |
add optional dark mode
-rwxr-xr-x | bin/korad-logger | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/bin/korad-logger b/bin/korad-logger index e9d97f5..71e2965 100755 --- a/bin/korad-logger +++ b/bin/korad-logger @@ -52,6 +52,8 @@ import time terminate_measurement = False +matplotlib_theme = "fast" + def running_mean(x: np.ndarray, N: int) -> np.ndarray: """ @@ -308,7 +310,7 @@ def measure_data( if live_view: import matplotlib.pyplot as plt - plt.style.use("dark_background") + plt.style.use(matplotlib_theme) timestamps = list() voltages = list() @@ -427,6 +429,8 @@ def measure_data( def plot_data(data, mode): import matplotlib.pyplot as plt + plt.style.use(matplotlib_theme) + if mode == "U": (datahandle,) = plt.plot(data[:, 0], data[:, 1], "b-", label="U", markersize=1) (meanhandle,) = plt.plot( @@ -651,6 +655,9 @@ def main(): help="Plot voltage / current / power over time or voltage vs current / current vs voltage", ) parser.add_argument( + "--dark-mode", action="store_true", help="Show plots on a dark background" + ) + parser.add_argument( "duration", type=int, nargs="?", help="Measurement duration in seconds" ) @@ -660,6 +667,10 @@ def main(): print("Either --load or duration must be specified", file=sys.stderr) sys.exit(1) + if args.dark_mode: + global matplotlib_theme + matplotlib_theme = "dark_background" + current_range = parse_range(args.current_range) voltage_range = parse_range(args.voltage_range) |