<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>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # seaborn.swarmplot > 譯者:[LIJIANcoder97](https://github.com/LIJIANcoder97) ```py seaborn.swarmplot(x=None, y=None, hue=None, data=None, order=None, hue_order=None, dodge=False, orient=None, color=None, palette=None, size=5, edgecolor='gray', linewidth=0, ax=None, **kwargs) ``` 繪制具有非重疊點的分類散點圖。 此功能類似于 [`stripplot()`](seaborn.stripplot.html#seaborn.stripplot "seaborn.stripplot"),,但調整點(僅沿分類軸),以便它們不重疊。 這樣可以更好地表示值的分布,但不能很好地擴展到大量觀察值。這種情節有時被稱為“詛咒” 一個群體圖可以單獨繪制,但如果你想要顯示所有觀察結果以及底層分布的一些表示,它也是一個盒子或小提琴圖的良好補充。 正確排列點需要在數據和點坐標之間進行精確轉換。這意味著必須在繪制繪圖之前設置非默認軸限制。 輸入數據可以以多種格式傳遞,包括: * 表示為列表,numpy arrays 或 pandas Series objects 直接傳遞給`x`,`y`和/或`hue`參數。 * “長格式” DataFrame, `x`,`y`和`hue`變量將決定數據的繪制方式 * “寬格式”DataFrame,用于繪制每個數字列。 * 一個數組或向量列表。 在大多數情況下,可以使用 numpy 或 Python 對象,但最好使用 pandas 對象,因為關聯的名稱將用于注釋軸。此外,您可以使用分類類型來分組變量來控制繪圖元素的順序。 此函數始終將其中一個變量視為分類,并在相關軸上的序數位置(0,1,... n)處繪制數據,即使數據具有數字或日期類型也是如此 有關更多信息,請參閱[教程](http://seaborn.pydata.org/tutorial/categorical.html#categorical-tutorial)。 參數:`x, y, hue`:`數據`或矢量數據中的變量名稱,可選 > 用于繪制長格式數據的輸入。查看解釋示例。 `data`:DataFrame, array, or 或數組列表, 可選 > 用于繪圖的數據集。 如果 `x` 和 `y` 是不存在的, 會被解釋成 wide-form. 否則會被解釋成 long-form. `order, hue_order`:字符串列表,可選 > 命令繪制分類級別,否則從數據對象推斷級別。 `dodge`:布爾,可選 > 使用`hue`嵌套時,將其設置為`True`將沿著分類軸分離不同色調級別的條帶。 否則,每個級別的點將繪制在一個群中。 `orient`:“v” &#124; “h”, 可選 > 圖的方向(垂直或水平)。這通常是從輸入變量的 dtype 推斷出來的,但可用于指定“分類”變量何時是數字或何時繪制寬格式數據。 `color`:matplotlib color, 可選 > 所有元素的顏色,或漸變調色板的種子。 `palette`:調色板名稱, list, or dict, 可選 > 用于`hue`變量的不同級別的顏色。應該是[`color_palette()`](seaborn.color_palette.html#seaborn.color_palette "seaborn.color_palette"),可以解釋的東西,或者是將色調級別映射到 matplotlib 顏色的字典。 `size`:float, 可選 > 標記的直徑,以點為單位。 (盡管`plt.scatter`用于繪制點,但此處的`size`參數采用“普通”標記大小而不是大小^ 2,如`plt.scatter`。 `edgecolor`:matplotlib color, “灰色”是特殊的,可選 > 每個點周圍線條的顏色。如果傳遞`"gray"`,則亮度由用于點體的調色板決定。 `linewidth`:float, 可選 > 構圖元素的灰線寬度。 `ax`:matplotlib Axes, 可選 > Axes 對象將繪圖繪制到,否則使用當前軸。 返回值:`ax`:matplotlib Axes > 返回 Axes 對象,并在其上繪制繪圖。 參看 帶有類似 API 的傳統盒須圖。框圖和核密度估計的組合。散點圖,其中一個變量是分類的。可以與其他圖一起使用以顯示每個觀察結果。使用類組合分類圖:<cite>FacetGrid</cite>。 例 繪制單個水平群圖: ```py >>> import seaborn as sns >>> sns.set(style="whitegrid") >>> tips = sns.load_dataset("tips") >>> ax = sns.swarmplot(x=tips["total_bill"]) ``` ![http://seaborn.pydata.org/_images/seaborn-swarmplot-1.png](https://img.kancloud.cn/6d/d0/6dd0f9c1d00ac94c84b589ec49260852_576x432.jpg) 通過分類變量對群組進行分組: ```py >>> ax = sns.swarmplot(x="day", y="total_bill", data=tips) ``` ![http://seaborn.pydata.org/_images/seaborn-swarmplot-2.png](https://img.kancloud.cn/06/de/06de81a74ed6ca3b978c830460237612_576x432.jpg) 繪制水平群: ```py >>> ax = sns.swarmplot(x="total_bill", y="day", data=tips) ``` ![http://seaborn.pydata.org/_images/seaborn-swarmplot-3.png](https://img.kancloud.cn/cf/6a/cf6aea76046183eb255c178e54582590_576x432.jpg) 使用第二個分類變量為點著色: ```py >>> ax = sns.swarmplot(x="day", y="total_bill", hue="sex", data=tips) ``` ![http://seaborn.pydata.org/_images/seaborn-swarmplot-4.png](https://img.kancloud.cn/d8/03/d803aff05e6209d646998689a2f3b6bc_576x432.jpg) 沿著分類軸拆分 `hue` 變量的每個級別: ```py >>> ax = sns.swarmplot(x="day", y="total_bill", hue="smoker", ... data=tips, palette="Set2", dodge=True) ``` ![http://seaborn.pydata.org/_images/seaborn-swarmplot-5.png](https://img.kancloud.cn/ae/c0/aec0a1acf48a20968d15c13a9ce049f4_576x432.jpg) 通過傳遞顯式順序來控制 swarm 順序: ```py >>> ax = sns.swarmplot(x="time", y="tip", data=tips, ... order=["Dinner", "Lunch"]) ``` ![http://seaborn.pydata.org/_images/seaborn-swarmplot-6.png](https://img.kancloud.cn/2f/dc/2fdc0ee7ccacdaf51970ff8177908482_576x432.jpg) 繪制使用更大的點 ```py >>> ax = sns.swarmplot(x="time", y="tip", data=tips, size=6) ``` ![http://seaborn.pydata.org/_images/seaborn-swarmplot-7.png](https://img.kancloud.cn/3b/4f/3b4f0fc6448b82babe9b8cb3e86ab3a3_576x432.jpg) 在箱形圖上繪制大量觀察結果: ```py >>> ax = sns.boxplot(x="tip", y="day", data=tips, whis=np.inf) >>> ax = sns.swarmplot(x="tip", y="day", data=tips, color=".2") ``` ![http://seaborn.pydata.org/_images/seaborn-swarmplot-8.png](https://img.kancloud.cn/71/52/7152da95716086d0b9b626177d375e0f_576x432.jpg) 在小提琴圖的頂部畫出大量的觀察結果: ```py >>> ax = sns.violinplot(x="day", y="total_bill", data=tips, inner=None) >>> ax = sns.swarmplot(x="day", y="total_bill", data=tips, ... color="white", edgecolor="gray") ``` ![http://seaborn.pydata.org/_images/seaborn-swarmplot-9.png](https://img.kancloud.cn/75/36/7536cba5967dd8b8fbf18b65b4fc4258_576x432.jpg) 使用[`catplot()`](seaborn.catplot.html#seaborn.catplot "seaborn.catplot") 去組合 [`swarmplot()`](#seaborn.swarmplot "seaborn.swarmplot") 和 [`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid"). 這允許在其他分類變量中進行分組。 使用 [`catplot()`](seaborn.catplot.html#seaborn.catplot "seaborn.catplot") 比直接使用 [`FacetGrid`](seaborn.FacetGrid.html#seaborn.FacetGrid "seaborn.FacetGrid") 更安全,因為它確保了跨 facet 的變量順序的同步 ```py >>> g = sns.catplot(x="sex", y="total_bill", ... hue="smoker", col="time", ... data=tips, kind="swarm", ... height=4, aspect=.7); ``` ![http://seaborn.pydata.org/_images/seaborn-swarmplot-10.png](https://img.kancloud.cn/25/0f/250f2d210da2b5c7e5da299cefd0ed9a_577x360.jpg)
                  <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>

                              哎呀哎呀视频在线观看