Plot results and save to file.
(results, title, filename)
| 221 | return multiturn_results |
| 222 | |
| 223 | def plot_results(results, title, filename): |
| 224 | """Plot results and save to file.""" |
| 225 | df = pd.DataFrame(results) |
| 226 | df = df[df['elapsed'].notnull()] |
| 227 | if df.empty: |
| 228 | print(f"No successful results to plot for {title}.") |
| 229 | return |
| 230 | plt.figure(figsize=(10, 6)) |
| 231 | ax = plt.gca() |
| 232 | df.boxplot(column='elapsed', by=['provider'], ax=ax) |
| 233 | plt.title(title) |
| 234 | plt.suptitle("") |
| 235 | plt.ylabel('Elapsed Time (s)') |
| 236 | plt.xlabel('Provider') |
| 237 | plt.xticks(rotation=45, ha='right') |
| 238 | plt.tight_layout() |
| 239 | plt.savefig(filename) |
| 240 | plt.show() |
| 241 | |
| 242 | def plot_total_conversation_time(results, title, filename): |
| 243 | """Plot total conversation time per provider and save to file.""" |