Reputation: 1007
I have the following heatmap:
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
# Create a sample heatmap
data = np.random.rand(10, 12)
ax = sns.heatmap(data)
# Set the x-axis label
ax.set_xlabel('X Axis Label')
# Change the background color of the x-axis label
ax.xaxis.label.set_bbox(dict(facecolor='lightgrey', edgecolor='none', boxstyle='square,pad=0.3'))
plt.show()
I would like to extend the grey box from the beginning to the end of the x-axis (the edges of the heatmap). How can I do that?
Upvotes: 1
Views: 32