Цветная полоса не показана на нескольких участках Seaborn Jointplot - PullRequest
0 голосов
/ 29 января 2020

Как указано в ответе на вопрос, можно построить несколько совместных диаграмм Seanborn по SeabornFig2Grid.

Однако цветовые полосы не отображаются:

import matplotlib.pyplot as plt
import seaborn as sns;
sns.set(style="white", color_codes=True)

import seabornfig2grid as sfg
import matplotlib.gridspec as gridspec

iris = sns.load_dataset("iris")

g1 = sns.jointplot("sepal_width", "petal_length", data=iris,
                  kind="kde", space=0, color="g",
                  cbar=True, cbar_kws={"label": 'Normalized Densities'},
                  )

g2 = sns.jointplot("sepal_width", "petal_length", data=iris,
                  kind="kde", space=0, color="g",
                  cbar=True, cbar_kws={"label": 'Normalized Densities'},
                  )

fig = plt.figure(figsize=(13,8))
gs = gridspec.GridSpec(1, 2)

mg0 = sfg.SeabornFig2Grid(g1, fig, gs[0])
mg1 = sfg.SeabornFig2Grid(g2, fig, gs[1])

gs.tight_layout(fig)

Seaborn_subplots

Обновление / Решение

Вот мое решение:

mg0 = sfg.SeabornFig2Grid(g1, fig, gs[0])
mg1 = sfg.SeabornFig2Grid(g2, fig, gs[1])

mappable0 = g1.fig.axes[0].collections[0]
mappable1 = g2.fig.axes[0].collections[0]

gs.tight_layout(fig)
fig.colorbar(mappable0, ax=mg0.fig.axes[0])
fig.colorbar(mappable1, ax=mg1.fig.axes[3])

Solution

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...