To change the colors used in the legend for this plot, you can modify the color parameter in the hist() function. Here's an example of how you could customize the colors:
# Define a custom color palette
colors = ['red', 'blue', 'green', 'purple', 'orange', 'brown']
# Modify the hist() calls to include the custom colors
axes[0,0].hist(conf_loss_dTdt_offline_diff, bins=bin_edges, stacked=True, alpha=0.7,
label=['U-Net', 'Squeezeformer', 'Pure ResLSTM', 'Pao Model', 'ConvNeXt', 'Encoder-Decoder LSTM'],
edgecolor='black', color=colors)
You can replace the colors list with any colors you prefer. Some options include:
Named colors: 'red', 'blue', 'green', etc.
Hex color codes: '#FF0000', '#00FF00', etc.
RGB tuples: (1,0,0), (0,1,0), etc.
If you want more nuanced color selection, you could also use color palettes from libraries like seaborn:
import seaborn as sns
# Use a predefined color palette
colors = sns.color_palette("Set2", 6)
Make sure to apply the color parameter consistently across all your hist() calls to maintain color consistency across subplots.
If you want to fine-tune the legend colors separately from the histogram colors, you can use axes[x,y].legend() with a color parameter for each legend entry.