Search code examples
pythonmatplotlibseabornjointplot

How to show the vertical scale of marginal histogram in a jointplot


In Seaborn jointplot, the marginal histograms do not show the y axis values. How can I get these values? The documentation doesn't show any arguments to change this behavior.


Solution

  • You're going to have to work more on the matplotlib side of things. If you just want to get the limits of the axis, you can use get_ylim. The handle for those histograms are ax_marg_x and ax_marg_y.

    g = sns.jointplot(...)
    g.ax_marg_x.get_ylim()
    

    You can also make the tick labels visible using set_visible on the tick labels:

    for tick in g.ax_marg_x.get_yticklabels():
        tick.set_visible(True)
    

    enter image description here

    You can also create your own tick labels with set_yticklabels.