-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgorsel.py
More file actions
29 lines (21 loc) · 949 Bytes
/
gorsel.py
File metadata and controls
29 lines (21 loc) · 949 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
# Veriyi yükleyin
df = pd.read_csv("/home/analysis/Desktop/Tez Görselleri/gen_yeni/Kromozomal_AMR_Genleri.csv") # CSV dosyanızın yolunu buraya yazın
# Pivot tablo oluşturun (Yıl ve Gene'ye göre gen sayısını gruplandıralım)
df_pivot = df.groupby(['year', 'gene']).size().unstack(fill_value=0)
# Heatmap oluşturma
plt.figure(figsize=(14, 10))
ax = sns.heatmap(df_pivot, annot=True, fmt="d", cmap="viridis", linewidths=0.5, cbar_kws={"fraction": 0.3, "pad": 0.04})
# Grafik etiketleri ve başlık
plt.title("Yıllara Göre Antimikrobiyal Direnç Genleri Heatmap", fontsize=16)
plt.xlabel("Direnç Genleri", fontsize=12)
plt.ylabel("İzolasyon Yılı", fontsize=12)
# X eksenindeki etiketleri 45 derece yatık yapma
plt.xticks(rotation=45)
# Kare kutucuklar için aspect oranını eşitleme
ax.set_aspect('equal')
# Gösterim
plt.tight_layout()
plt.show()