Skip to content
Snippets Groups Projects
Commit 73ea73aa authored by Michael Reuscher's avatar Michael Reuscher
Browse files

DESY_logo for Plots

parent 78a5ff61
No related branches found
No related tags found
1 merge request!4Python driver and data analysis part
......@@ -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',
......
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()
......
visualizer/visualizer/desy_logo.png

23.9 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment