How can I change the tick placement in a seaborn jointplot or jointgrid?
I'm looking for something similar to matplotlib's plt.xticks
.
To decrease the density of x-ticks in Seaborn, we can use set_visible=False for odd positions.
Draw a plot of two variables with bivariate and univariate graphs. This function provides a convenient interface to the JointGrid class, with several canned plot kinds. This is intended to be a fairly lightweight wrapper; if you need more flexibility, you should use JointGrid directly.
Grid for drawing a bivariate plot with marginal univariate plots. Many plots can be drawn by using the figure-level interface jointplot() . Use this class directly when you need more flexibility.
You can access the 'axes' of a JointGrid
object using ax_joint
(for the main plot) and ax_marg_x
or ax_marg_y
for the marginal distributions' plots. Then, you can use the full API for the matplotlib axes to manipulate the details of the plot, and in particular you can use the get_xticks
/set_xticks
to change the tick placement.
Here's a basic example of how to use this to change the xticks/yticks positions:
import numpy as np
import seaborn as sns
g = sns.jointplot(np.random.rand(100), np.random.rand(100))
g.ax_joint.set_xticks([0, 0.34, 0.88])
g.ax_joint.set_yticks([-0.1, 0.5, 1, 1.1])
This results in the following plot:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With