import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
data = {
'L': ['L-4', 'L-4', 'L-4', 'L-8', 'L-8', 'L-8', 'L-16', 'L-16', 'L-16', 'L-24', 'L-24', 'L-24', 'L-32', 'L-32', 'L-32'],
'Method': ['LSTM & LSTM', 'GPT & Table', 'LSTM & Table'] * 5,
'Accuracy': [60, 50, 40, 70, 60, 50, 65, 55, 45, 68, 58, 48, 72, 62, 52]
}
df = pd.DataFrame(data)
fig, axs = plt.subplots(2, 3, figsize=(18, 12))
palette = {
'LSTM & LSTM': 'orange',
'GPT & Table': 'yellow',
'LSTM & Table': 'green'
}
for i, ax in enumerate(axs.flat):
sns.barplot(data=df, x='L', y='Accuracy', hue='Method', palette=palette, width=0.3, ax=ax)
ax.set_ylabel('Accuracy (%)')
ax.set_ylim(0, 100)
ax.set_title(f'Subplot {i + 1}', fontsize=14, loc='center', pad=20)
ax.legend(title='Methods', loc='upper right')
ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False)
ax.xaxis.set_ticks_position('none')
ax.yaxis.set_ticks_position('none')
plt.tight_layout()
plt.show()