By default, the y-axis histogram in a JointGrid plot with Seaborn is plotted horizontally. If you want to plot it vertically, you can use the annotate function from Matplotlib to rotate the histogram to the desired orientation. Here's an example of how to achieve this:
main.py494 chars18 lines
In the code above, we create a JointGrid using sns.JointGrid and specify the variables x and y from your data frame. We then use the annotate function to add a label for the y-axis histogram and rotate it vertically by setting the rotation parameter to 90.
After that, we plot the joint scatter plot using g.plot_joint with sns.scatterplot. Finally, we plot the marginal histogram for the x-axis using g.plot_marginals with sns.histplot.
gistlibby LogSnag