tools: Add interactive plotting.

Remove default SVG output, and plot interactively when no outputs are
specified.

Change-Id: Ie853da47ce91ca9fb3f89e7b01b20954bfe0a8a2
Reviewed-on: https://pigweed-review.googlesource.com/c/gonk/+/225891
Commit-Queue: Onath Dillinger <claridge@google.com>
Reviewed-by: Anthony DiGirolamo <tonymd@google.com>
Lint: Lint 🤖 <android-build-ayeaye@system.gserviceaccount.com>
diff --git a/tools/gonk_tools/plot.py b/tools/gonk_tools/plot.py
index b2eaf41..cc80441 100644
--- a/tools/gonk_tools/plot.py
+++ b/tools/gonk_tools/plot.py
@@ -121,14 +121,14 @@
         '-o',
         '--output-svg',
         type=Path,
-        default=Path('plot.svg'),
+        default=None,
         help='Output svg file.',
     )
     parser.add_argument(
         '-c',
         '--output-csv',
         type=Path,
-        default=Path(''),
+        default=None,
         help='Output csv file.',
     )
     return parser.parse_args()
@@ -141,9 +141,15 @@
 ) -> int:
     """Plot ADC values."""
     # pylint: disable=too-many-locals
-    print("Input %s, Output %s" % (input_text, output_svg))
-    if output_csv != Path(""):
-        print("Output csv file: %s" % output_csv)
+    print(f"Input {input_text}")
+    if output_svg:
+        print(f"Output svg file: {output_svg}")
+    if output_csv:
+        print(f"Output csv file: {output_csv}")
+
+    interactive_plotting = not (output_svg or output_csv)
+    if interactive_plotting:
+        print("No outputs specified; plotting interactively")
 
     start_time: Optional[datetime] = None
     time_values = []
@@ -244,9 +250,14 @@
     ax2.grid(True)
     ax3.legend()
     ax3.grid(True)
-    plt.savefig(output_svg)
 
-    if output_csv != Path(""):
+    if output_svg:
+        plt.savefig(output_svg)
+
+    if interactive_plotting:
+        plt.show()
+
+    if output_csv:
         with output_csv.open("w+") as fd:
             fd.write("ts")
             for i in range(0, ADC_COUNT):
diff --git a/tools/setup.cfg b/tools/setup.cfg
index 2263b55..33ecc69 100644
--- a/tools/setup.cfg
+++ b/tools/setup.cfg
@@ -26,6 +26,7 @@
     numpy
     pyfu-usb
     pyserial
+    PyQt6
 
 [options.entry_points]
 console_scripts =