<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # seaborn.JointGrid > 譯者:[Yet-sun](https://github.com/Yet-sun) ```py class seaborn.JointGrid(x, y, data=None, height=6, ratio=5, space=0.2, dropna=True, xlim=None, ylim=None, size=None) ``` 用于繪制具有邊際單變量圖的雙變量圖的網格。 ```py __init__(x, y, data=None, height=6, ratio=5, space=0.2, dropna=True, xlim=None, ylim=None, size=None) ``` 設置子圖的網格。 參數:`x, y`:字符串或向量 > 在 `data`中的數據或變量名 `data`:DataFrame, 可選 > 當 `x` and `y` 是變量名的時候為 DataFrame。 `height`:數字 > 圖中每一條邊的大小(以英寸為單位) `ratio`:數字 > 聯合軸大小與邊緣軸高度的比率。 `space`:數字,可選 > 聯合軸和邊緣軸之間的空間 `dropna`:bool, 可選 > 如果為 True,則刪除 `x` 和 `y`中缺少的觀察結果。 `{x, y}lim`:二元組,可選 > 在繪圖之前設置軸限制。 也可以看看 用于繪制具有多種不同默認繪圖類型的雙變量圖的高級界面。 例子: 初始化圖形,但不在其上繪制任何圖形: ```py >>> import seaborn as sns; sns.set(style="ticks", color_codes=True) >>> tips = sns.load_dataset("tips") >>> g = sns.JointGrid(x="total_bill", y="tip", data=tips) ``` ![http://seaborn.pydata.org/_images/seaborn-JointGrid-1.png](https://img.kancloud.cn/e4/23/e423f479133b1c5c31452962c9ba7ae0_540x540.jpg) 使用默認參數添加繪圖: ```py >>> g = sns.JointGrid(x="total_bill", y="tip", data=tips) >>> g = g.plot(sns.regplot, sns.distplot) ``` ![http://seaborn.pydata.org/_images/seaborn-JointGrid-2.png](https://img.kancloud.cn/c5/8a/c58a8b18df52c7880ff081e6d1bc045d_540x540.jpg) 分別繪制聯合分布圖和邊緣直方圖,這可以以更精細的級別控制其他參數: ```py >>> import matplotlib.pyplot as plt >>> g = sns.JointGrid(x="total_bill", y="tip", data=tips) >>> g = g.plot_joint(plt.scatter, color=".5", edgecolor="white") >>> g = g.plot_marginals(sns.distplot, kde=False, color=".5") ``` ![http://seaborn.pydata.org/_images/seaborn-JointGrid-3.png](https://img.kancloud.cn/89/4a/894adaf9d83ce7b265238b8361be969d_540x540.jpg) 分別繪制兩個邊緣直方圖: ```py >>> import numpy as np >>> g = sns.JointGrid(x="total_bill", y="tip", data=tips) >>> g = g.plot_joint(plt.scatter, color="m", edgecolor="white") >>> _ = g.ax_marg_x.hist(tips["total_bill"], color="b", alpha=.6, ... bins=np.arange(0, 60, 5)) >>> _ = g.ax_marg_y.hist(tips["tip"], color="r", alpha=.6, ... orientation="horizontal", ... bins=np.arange(0, 12, 1)) ``` ![http://seaborn.pydata.org/_images/seaborn-JointGrid-4.png](https://img.kancloud.cn/40/43/4043e5c09d8cf0a2c736f9e87e8fde9b_540x540.jpg) 添加注釋,其中包含總結雙變量關系的統計信息: ```py >>> from scipy import stats >>> g = sns.JointGrid(x="total_bill", y="tip", data=tips) >>> g = g.plot_joint(plt.scatter, ... color="g", s=40, edgecolor="white") >>> g = g.plot_marginals(sns.distplot, kde=False, color="g") >>> g = g.annotate(stats.pearsonr) ``` ![http://seaborn.pydata.org/_images/seaborn-JointGrid-5.png](https://img.kancloud.cn/1b/52/1b52b9a29a814810cd99f301cc4fbb9a_540x540.jpg) 使用自定義的函數和注釋格式 ```py >>> g = sns.JointGrid(x="total_bill", y="tip", data=tips) >>> g = g.plot_joint(plt.scatter, ... color="g", s=40, edgecolor="white") >>> g = g.plot_marginals(sns.distplot, kde=False, color="g") >>> rsquare = lambda a, b: stats.pearsonr(a, b)[0] ** 2 >>> g = g.annotate(rsquare, template="{stat}: {val:.2f}", ... stat="$R^2$", loc="upper left", fontsize=12) ``` ![http://seaborn.pydata.org/_images/seaborn-JointGrid-6.png](https://img.kancloud.cn/4e/f1/4ef17513b2005d9ecbe8b972bb0e0d18_540x540.jpg) 移除聯合軸和邊緣軸之間的空間: ```py >>> g = sns.JointGrid(x="total_bill", y="tip", data=tips, space=0) >>> g = g.plot_joint(sns.kdeplot, cmap="Blues_d") >>> g = g.plot_marginals(sns.kdeplot, shade=True) ``` ![http://seaborn.pydata.org/_images/seaborn-JointGrid-7.png](https://img.kancloud.cn/12/64/1264ad214f3fbc7b6886f928b1e9cfbf_540x540.jpg) 繪制具有相對較大邊緣軸的較小圖: ```py >>> g = sns.JointGrid(x="total_bill", y="tip", data=tips, ... height=5, ratio=2) >>> g = g.plot_joint(sns.kdeplot, cmap="Reds_d") >>> g = g.plot_marginals(sns.kdeplot, color="r", shade=True) ``` ![http://seaborn.pydata.org/_images/seaborn-JointGrid-8.png](https://img.kancloud.cn/d3/08/d308fae6d67ed76670c1ae7e59291595_450x450.jpg) 設置軸的限制: ```py >>> g = sns.JointGrid(x="total_bill", y="tip", data=tips, ... xlim=(0, 50), ylim=(0, 8)) >>> g = g.plot_joint(sns.kdeplot, cmap="Purples_d") >>> g = g.plot_marginals(sns.kdeplot, color="m", shade=True) ``` ![http://seaborn.pydata.org/_images/seaborn-JointGrid-9.png](https://img.kancloud.cn/92/a2/92a295b2b6b8103043f20dcf6ecdca0c_540x540.jpg) 方法 [`__init__`](#seaborn.JointGrid.__init__ "seaborn.JointGrid.__init__")(x,?y[,?data,?height,?ratio,?space,?…]) | 設置子圖的網格設置子圖的網格。 `annotate`(func[,?template,?stat,?loc]) | 用關于關系的統計數據來標注繪圖。 [`plot`](seaborn.JointGrid.plot.html#seaborn.JointGrid.plot "seaborn.JointGrid.plot")(joint_func,?marginal_func[,?annot_func]) | 繪制完整繪圖的快捷方式。 [`plot_joint`](seaborn.JointGrid.plot_joint.html#seaborn.JointGrid.plot_joint "seaborn.JointGrid.plot_joint")(func,?**kwargs) | 繪制 `x` 和 `y`的雙變量圖。 [`plot_marginals`](seaborn.JointGrid.plot_marginals.html#seaborn.JointGrid.plot_marginals "seaborn.JointGrid.plot_marginals")(func,?**kwargs) | 分別繪制 `x` 和 `y` 的單變量圖。 `savefig`(*args,?**kwargs) | 封裝 figure.savefig 默認為緊邊界框。 `set_axis_labels`([xlabel,?ylabel]) |在雙變量軸上設置軸標簽。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看