Search code examples
pythonseabornaxesjointplot

seaborn joint plot, how to remove space between marginal axes


I'm trying to plot a seaborn joint plot, but the axis lines are not connected. How can I connect the marginal axes back to the main plot?

sns_plot = sns.jointplot(x = 'f48', y= x,data=df, 
                     kind ='kde',
                     cmap = 'plasma')

sns_plot.set_axis_labels(xlabel = 'CD',ylabel = 'x position', size =14)
plt.suptitle('joint plot',y = 0.97, size =24) # title
plt.tight_layout()
plt.show() 

enter image description here


Solution

  • jointplot adds padding between the axes:

    space : Space between the joint and marginal axes (default 0.2)

    Connect the marginal axes by setting space=0:

    sns.jointplot(x='sepal_length', y='sepal_width', data=sns.load_dataset('iris'),
                  kind='kde', cmap='plasma', space=0)
    #                                        -------