diff --git a/visualizer/setup.py b/visualizer/setup.py index c084007c478a194fd260f23a5912ac069e6e8d9f..bb05267285534dae28d818aa1b8b125ad92966d6 100644 --- a/visualizer/setup.py +++ b/visualizer/setup.py @@ -5,6 +5,7 @@ setup( version='1.0', description='visualizer for detector-sim', author='Michael Reuscher', + package_data={'': ['desy_logo.png']}, packages=find_packages(), install_requires=[ 'numpy', diff --git a/visualizer/visualizer/SeabornPlotter.py b/visualizer/visualizer/SeabornPlotter.py index 65c62f373bd23b4689c75c1bf4a630ab9459a064..48a836fc0440448a721c1c2e208f0f7cf82a7a2c 100644 --- a/visualizer/visualizer/SeabornPlotter.py +++ b/visualizer/visualizer/SeabornPlotter.py @@ -1,6 +1,8 @@ import numpy as np import matplotlib.pyplot as plt import seaborn as sns +from matplotlib.offsetbox import OffsetImage, AnnotationBbox +import os import pandas as pd sns.set_theme() @@ -12,39 +14,45 @@ class SeabornPlotter: self.name = name self.current_plot = None - def configure_plot(self, ax): - if self.name == "idle" or self.name == "wait": - ax.set_yscale('symlog', linthresh=0.1) - else: - ax.set_yscale('log') - def plot(self): df = self.dataframe x = df['size'] y = df['duration'] title = "Procedure: {}".format(self.name) + + # Bin Grenzen festlegen n = df['size'].nunique() bins_x = np.zeros(n + 1, dtype=np.float64) bins_x[0] = 0.75 * (1 << 4) for i in range(1, n + 1): bins_x[i] = bins_x[i - 1] * 2 - print(bins_x) bins_y = np.logspace(-6, 0, num=101) + # Achsen und Plot definieren f, ax = plt.subplots(figsize=(16, 9)) sns.histplot(x=x, y=y, color="blue", bins=[bins_x, bins_y],) - # Anpassung der Achsenbeschriftungen und des Titels - ax.set_xlabel("Data size [Bytes]") - ax.set_ylabel("Time/Event [s]") - plt.title(title) - # Setze die Skala der x-Achse auf logarithmisch ax.set_xscale('log') ax.set_yscale('log') + # Setze die Beschriftungen + ax.set_xlabel("Data size [Bytes]") + ax.set_ylabel("Time/Event [s]") + plt.title(title) plt.grid(True) plt.xticks(rotation=45) + current_directory = os.path.dirname(os.path.abspath(__file__)) + logo_path = os.path.join(current_directory, "desy_logo.png") + logo_img = plt.imread(logo_path) + logo_size = 0.15 + logo_x = 1.065 + logo_y = 1.04 + imagebox = OffsetImage(logo_img, zoom=logo_size) + ab = AnnotationBbox(imagebox, (logo_x, logo_y), xycoords='axes fraction', frameon=False) + plt.gca().add_artist(ab) + + # Speichern und Anzeigen plt.savefig(title + ".svg", format='svg') plt.show() diff --git a/visualizer/visualizer/desy_logo.png b/visualizer/visualizer/desy_logo.png new file mode 100755 index 0000000000000000000000000000000000000000..7a529ba4e22b50bf2eff9fe7278f057d86e789bc Binary files /dev/null and b/visualizer/visualizer/desy_logo.png differ