python - Drawing Diagonal line (line of equality) on Seaborn Jointplot -
i'm using seaborn jointplot scatterplotting purposes, can't seem simple diagonal line going across... i'm getting attributeerror: 'jointgrid' object has no attribute 'get_xlim'
. know workaround using seaborn?
here's code (also title doesn't show up! gives):
ax = sns.jointplot(x="av tomato-meter", y="av audience score", data=director_combined_ratings, stat_func = none, size = 8, xlim=(0,100), ylim=(0,100)) ax.plot(ax.get_xlim(), ax.get_ylim(), ls="--", c=".3") #this error line. ax.title = "average tomato-meter vs audience score directors on 10 movies"
thanks in advance everyone.
the error useful hint: jointplot congeries of subplots, have find specific ax plot onto. modifying seaborn example:
import numpy np import pandas pd import seaborn sns matplotlib.pyplot import show sns.set(style="white") # generate random correlated bivariate dataset rs = np.random.randomstate(5) mean = [0, 0] cov = [(2, .25), (.5, 1)] # make asymmetric better test of x=y line x1, x2 = rs.multivariate_normal(mean, cov, 500).t x1 = pd.series(x1, name="$x_1$") x2 = pd.series(x2, name="$x_2$") # show joint distribution using kernel density estimation g = sns.jointplot(x1, x2, kind="kde", size=7, space=0) x0, x1 = g.ax_joint.get_xlim() y0, y1 = g.ax_joint.get_ylim() lims = [max(x0, y0), min(x1, y1)] g.ax_joint.plot(lims, lims, ':k') show()
i figured out in interpreter: dir(g)
, g.plot?
, g.plot_joint?
-- plotting functions specific jointplot -- else there? -- dir(g.ax_joint)
; aha, there's set_ylim
, etc.
Comments
Post a Comment