| import matplotlib.pyplot as plt |
| import seaborn as sns |
|
|
| |
| |
| |
| |
| error_types = ['wrong_column', 'wrong_table', 'ambiguous_column', 'other'] |
| error_counts = [61, 11, 4, 1] |
|
|
| |
| sql_ops = ['WHERE', 'JOIN', 'ORDER BY', 'GROUP BY'] |
| op_counts = [55, 36, 20, 14] |
|
|
| |
| |
| |
| |
| sns.set_theme(style="whitegrid") |
| fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(14, 6)) |
|
|
| |
| |
| |
| sns.barplot(x=error_counts, y=error_types, ax=ax1, palette="flare") |
| ax1.set_title('Primary Cause of Failure (Total: 77 Errors)', fontsize=14, pad=15, fontweight='bold') |
| ax1.set_xlabel('Number of Queries') |
| ax1.set_ylabel('') |
|
|
| |
| for i, v in enumerate(error_counts): |
| ax1.text(v + 1.5, i, f"{v}", color='#333333', va='center', fontweight='bold') |
|
|
| |
| |
| |
| sns.barplot(x=sql_ops, y=op_counts, ax=ax2, palette="crest") |
| ax2.set_title('Clauses Present in Failed Queries', fontsize=14, pad=15, fontweight='bold') |
| ax2.set_ylabel('Frequency') |
| ax2.set_xlabel('') |
|
|
| |
| for i, v in enumerate(op_counts): |
| ax2.text(i, v + 1, str(v), color='#333333', ha='center', fontweight='bold') |
|
|
| |
| |
| |
| plt.suptitle('Text-to-SQL Error Diagnostic Dashboard', fontsize=18, fontweight='heavy', y=1.05) |
| sns.despine(left=True, bottom=True) |
| plt.tight_layout() |
|
|
| |
| plt.savefig('error_diagnostic_plot.png', dpi=300, bbox_inches='tight') |
| print("✅ Plot successfully saved as 'error_diagnostic_plot.png'") |
|
|
| |
| plt.show() |