Untitled

 avatar
unknown
plain_text
21 days ago
1.3 kB
1
Indexable
import matplotlib.pyplot as plt

# Data for threat detection times
companies = ['CrowdStrike', 'Microsoft']
pre_ai_detection = [72, 120]  # in hours
post_ai_detection = [0.08, 0.25]  # in hours (converted from minutes)

# Plot
fig, ax = plt.subplots(figsize=(8, 6))
bar_width = 0.35
bar1 = plt.bar([i - bar_width/2 for i in range(len(companies))], pre_ai_detection, 
               width=bar_width, label='Pre-AI Detection Time', color='skyblue')
bar2 = plt.bar([i + bar_width/2 for i in range(len(companies))], post_ai_detection, 
               width=bar_width, label='Post-AI Detection Time', color='orange')

# Labels and title
plt.xlabel('Companies', fontsize=12)
plt.ylabel('Threat Detection Time (Hours)', fontsize=12)
plt.title('Threat Detection Times Before and After AI Integration', fontsize=14)
plt.xticks(range(len(companies)), companies, fontsize=11)
plt.legend()

# Adding numerical values on top of the bars
for bar in bar1:
    yval = bar.get_height()
    plt.text(bar.get_x() + bar.get_width()/2, yval + 2, round(yval, 2), ha='center', fontsize=10)

for bar in bar2:
    yval = bar.get_height()
    plt.text(bar.get_x() + bar.get_width()/2, yval + 2, round(yval, 2), ha='center', fontsize=10)

# Display
plt.tight_layout()
plt.show()
Leave a Comment