Reputation: 1967
Given the following example:
A = [0, 1, 2]
B = [3, 4, 5]
C = [6, 7, 8, 9]
df = pd.DataFrame(data = {'D': np.random.randn(3*3*4)},
index = pd.MultiIndex.from_product([A, B, C], names=['A', 'B', 'C']))
df.reset_index(['B', 'C'], inplace=True)
def facet_heatmap(data, color):
data = data.pivot(columns='B', values='D')
ax = sns.heatmap(data, square=True, cmap="coolwarm", linewidths=0.0, rasterized=True, cbar=False)
ax.invert_yaxis()
g = sns.FacetGrid(df, col='C', col_wrap=2)
g.map_dataframe(facet_heatmap)
and when using the optional parameter square=True, there are some grey borders in every subplot of the grid. However, when square=False (the default) the grey border disappears. Anyone knows how to remove the grey border while keeping square=True?
Upvotes: 1
Views: 1304
Reputation: 2295
It's not a border, just a grey background. You can use seaborn's set_style
function to set it to white:
sns.set_style("whitegrid")
Upvotes: 4