-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c67fe3e
commit 9d8e2e0
Showing
9 changed files
with
325 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
|
||
|
||
def plot_graph(results, labels): | ||
font = {'size': 40} | ||
plt.rc('font', **font) | ||
# Define colors for each platform | ||
colors = { | ||
'FIFO': 'cyan', | ||
'Latency Sensitive': 'red', | ||
'MVVM': 'blue', | ||
} | ||
|
||
# Create figure and axis | ||
fig, ax = plt.subplots(figsize=(10, 10)) | ||
|
||
# Create bar positions | ||
x = np.arange(len(results)) | ||
|
||
# Create bars with specified colors | ||
bars = ax.bar(x, results, width=0.3) | ||
|
||
# Color each bar according to the platform | ||
for bar, label in zip(bars, labels): | ||
bar.set_color(colors.get(label, 'gray')) # Default to gray if color not found | ||
|
||
# Customize the plot | ||
ax.set_ylabel('Latency (s)') | ||
ax.set_xticks(x) | ||
ax.set_xticklabels(labels, rotation=45, fontsize=30) | ||
|
||
# Add value labels on top of each bar | ||
for bar in bars: | ||
height = bar.get_height() | ||
ax.text(bar.get_x() + bar.get_width()/2., height, | ||
f'{height:.4f}', | ||
ha='center', va='bottom') | ||
|
||
# Add grid for better readability | ||
ax.grid(True, axis='y', linestyle='--', alpha=0.7) | ||
|
||
# Adjust layout to prevent label cutoff | ||
plt.tight_layout() | ||
|
||
return plt | ||
|
||
# Example usage: | ||
results = [898.078, 745.393, 482.713] # Example values | ||
platforms = ['FIFO', 'Latency Sensitive', 'MVVM'] | ||
|
||
# Create and save the plot | ||
plot = plot_graph(results, platforms) | ||
plot.savefig('fifo_latency_vs_mvvm.pdf') | ||
plot.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
|
||
|
||
def plot_graph(results1, results2, labels): | ||
font = {'size': 40} | ||
plt.rc('font', **font) | ||
# Define colors for each platform | ||
colors = { | ||
'langgraph': 'cyan', | ||
'azure_model': 'cyan', | ||
'email_auto_responder_flow': 'cyan', | ||
'game-builder-crew': 'cyan', | ||
'instagram_post': 'cyan', | ||
'job-posting': 'cyan', | ||
} | ||
|
||
# Create figure and axis | ||
fig, ax = plt.subplots(figsize=(10, 10)) | ||
|
||
# Create bar positions | ||
x = np.arange(len(results1)) | ||
|
||
# Create bars with specified colors | ||
bars1 = ax.bar(x, results1, width=0.1) | ||
bars2 = ax.bar(x+0.1, results2, width=0.1) | ||
|
||
# Color each bar according to the platform | ||
for bar, label in zip(bars1, labels): | ||
bar.set_color( 'cyan') # Default to gray if color not found | ||
for bar, label in zip(bars2, labels): | ||
bar.set_color( 'purple') # Default to gray if color not found | ||
# Customize the plot | ||
ax.set_ylabel('Latency (s)') | ||
ax.set_xticks(x) | ||
ax.set_xticklabels(labels, rotation=45, fontsize=20) | ||
|
||
# Add value labels on top of each bar | ||
for bar in bars1: | ||
height = bar.get_height() | ||
ax.text(bar.get_x() + bar.get_width()/2., height, | ||
f'{height:.2f}', | ||
ha='center', va='bottom') | ||
|
||
for bar in bars2: | ||
height = bar.get_height() | ||
ax.text(bar.get_x() + bar.get_width()/2., height, | ||
f'{height:.2f}', | ||
ha='center', va='bottom') | ||
|
||
# Add grid for better readability | ||
ax.grid(True, axis='y', linestyle='--', alpha=0.7) | ||
|
||
# Adjust layout to prevent label cutoff | ||
plt.tight_layout() | ||
|
||
return plt | ||
|
||
# Example usage: | ||
results1 = [1.0, 1.0, 1.0] # Example values | ||
results2 = [8.823, 1.0, 1.0] # Example values | ||
platforms = ["job-post","long_file_translate","write_seo_blog_humanize"] | ||
|
||
# Create and save the plot | ||
plot = plot_graph(results1, results2, platforms) | ||
plot.savefig('crewai_vs_openai.pdf') | ||
plot.close() |
Oops, something went wrong.