From 37f5587a815f8137e4863a1ed99709aebc8a9c28 Mon Sep 17 00:00:00 2001 From: Daniel Miessler Date: Sat, 2 Mar 2024 15:43:15 -0800 Subject: [PATCH] removed temp plot. --- helpers/visualize | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 helpers/visualize diff --git a/helpers/visualize b/helpers/visualize new file mode 100755 index 0000000..10686c6 --- /dev/null +++ b/helpers/visualize @@ -0,0 +1,35 @@ +#!/usr/bin/env python + +import matplotlib.pyplot as plt +import base64 +import webbrowser +from io import BytesIO + +# Create a simple plot using matplotlib +plt.plot([1, 2, 3, 4]) +plt.ylabel('Some numbers') + +# Save the plot to a BytesIO object +img_buffer = BytesIO() +plt.savefig(img_buffer, format='png') +img_buffer.seek(0) + +# Encode the image as Base64 +img_base64 = base64.b64encode(img_buffer.read()).decode('utf-8') + +# Create an HTML file with the embedded image +html = f""" + + + + + +""" + +# Write the HTML to a temporary file +with open('temp_plot.html', 'w') as f: + f.write(html) + +# Open the HTML file in a browser +webbrowser.open('temp_plot.html') +