久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<small id='SoLLo'></small><noframes id='SoLLo'>

<tfoot id='SoLLo'></tfoot>
      <bdo id='SoLLo'></bdo><ul id='SoLLo'></ul>
      <i id='SoLLo'><tr id='SoLLo'><dt id='SoLLo'><q id='SoLLo'><span id='SoLLo'><b id='SoLLo'><form id='SoLLo'><ins id='SoLLo'></ins><ul id='SoLLo'></ul><sub id='SoLLo'></sub></form><legend id='SoLLo'></legend><bdo id='SoLLo'><pre id='SoLLo'><center id='SoLLo'></center></pre></bdo></b><th id='SoLLo'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='SoLLo'><tfoot id='SoLLo'></tfoot><dl id='SoLLo'><fieldset id='SoLLo'></fieldset></dl></div>
        <legend id='SoLLo'><style id='SoLLo'><dir id='SoLLo'><q id='SoLLo'></q></dir></style></legend>

      1. Seaborn Catplot 在條形圖上設置值

        Seaborn Catplot set values over the bars(Seaborn Catplot 在條形圖上設置值)
      2. <i id='p8Lxb'><tr id='p8Lxb'><dt id='p8Lxb'><q id='p8Lxb'><span id='p8Lxb'><b id='p8Lxb'><form id='p8Lxb'><ins id='p8Lxb'></ins><ul id='p8Lxb'></ul><sub id='p8Lxb'></sub></form><legend id='p8Lxb'></legend><bdo id='p8Lxb'><pre id='p8Lxb'><center id='p8Lxb'></center></pre></bdo></b><th id='p8Lxb'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='p8Lxb'><tfoot id='p8Lxb'></tfoot><dl id='p8Lxb'><fieldset id='p8Lxb'></fieldset></dl></div>

              <bdo id='p8Lxb'></bdo><ul id='p8Lxb'></ul>

              <small id='p8Lxb'></small><noframes id='p8Lxb'>

              <tfoot id='p8Lxb'></tfoot>

              <legend id='p8Lxb'><style id='p8Lxb'><dir id='p8Lxb'><q id='p8Lxb'></q></dir></style></legend>

                    <tbody id='p8Lxb'></tbody>
                • 本文介紹了Seaborn Catplot 在條形圖上設置值的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我像這樣在seaborn中繪制了一個catplot

                  將 seaborn 導入為 sns將熊貓導入為 pd數據= {'年':[2016、2013、2014、2015、2016、2013、2014、2015、2016、2013、2014、2015、2016、2013、2014、2015、2016、2013、2014、2015]geo_name': ['Michigan', 'Michigan', 'Michigan', 'Michigan', 'Washtenaw County, MI', 'Washtenaw County, MI', 'Washtenaw County, MI', 'Washtenaw County, MI', 'Ann密歇根州阿伯市"、密歇根州安娜堡"、密歇根州安娜堡"、密歇根州安娜堡"、賓夕法尼亞州費城"、賓夕法尼亞州費城"、賓夕法尼亞州費城"、賓夕法尼亞州費城"、'密歇根州安娜堡市都會區', '密歇根州安娜堡市都會區', '密歇根州安娜堡市都會區', '密歇根州安娜堡市都會區'], 'geo': ['04000US26', '04000US26','04000us26','04000us26','05000us26161','05000us26161','05000us26161','16000us2603000','16000us2603000','16000us2603000','16000us4260000','16000us4260000','16000US4260000','16000US4260000','16000US42600','16000US42600','16000US42600','16000US42600','16000US42600','16000US42600','16000US4260000''16000US4260000'','16000US4260000','31000US11460','31000US11460','31000US11460','31000us11460','收入':[50803.0,48411.0,49087.0,49576.0,62484.0,59055.0,60805.0,61003.0,57697.0,59003.0,56835.0,55990.0,39770.0,37192.0,37460.0,38253.0,62484.0,59055.0,60805.0,61003.0],收入_MOE":[162.0,163.0,192.0,186.0,984.0,985.0,958.0,901.0,2046.0,1688.0,1320.0,1259.0,567.0,424.0、430.0、511.0、984.0、985.0、958.0、901.0]}df = pd.DataFrame(數據)g = sns.catplot(x='year', y='income', data=df, kind='bar', hue='geo_name', legend=True)g.fig.set_size_inches(15,8)g.fig.subplots_adjust(top=0.81,right=0.86)

                  我得到如下所示的輸出

                  我想在 K 表示的頂部添加每個條的值.例如在 2013 中,Michigan 的欄位于 48411 所以我想在上面添加值 48.4K酒吧.對于所有的酒吧也是如此.

                  解決方案

                  更新至matplotlib v3.4.2

                  • 使用

                    對于單個或多個地塊

                    g = sns.catplot(x='year', y='income', data=df, kind='bar', col='geo_name',col_wrap=3,圖例=真)g.fig.set_size_inches(15, 8)g.fig.subplots_adjust(top=0.9)g.fig.suptitle('帶注釋的條形計數')# 遍歷軸對于 g.axes.ravel() 中的 ax:# 添加注釋對于 ax.containers 中的 c:標簽 = [f'{(v.get_height()/1000):.1f}K' for v in c]ax.bar_label(c, 標簽=標簽, label_type='edge')ax.margins(y=0.2)plt.show()

                    I plotted a catplot in seaborn like this

                    import seaborn as sns
                    import pandas as pd
                    
                    data  = {'year': [2016, 2013, 2014, 2015, 2016, 2013, 2014, 2015, 2016, 2013, 2014, 2015, 2016, 2013, 2014, 2015, 2016, 2013, 2014, 2015], 'geo_name': ['Michigan', 'Michigan', 'Michigan', 'Michigan', 'Washtenaw County, MI', 'Washtenaw County, MI', 'Washtenaw County, MI', 'Washtenaw County, MI', 'Ann Arbor, MI', 'Ann Arbor, MI', 'Ann Arbor, MI', 'Ann Arbor, MI', 'Philadelphia, PA', 'Philadelphia, PA', 'Philadelphia, PA', 'Philadelphia, PA', 'Ann Arbor, MI Metro Area', 'Ann Arbor, MI Metro Area', 'Ann Arbor, MI Metro Area', 'Ann Arbor, MI Metro Area'], 'geo': ['04000US26', '04000US26', '04000US26', '04000US26', '05000US26161', '05000US26161', '05000US26161', '05000US26161', '16000US2603000', '16000US2603000', '16000US2603000', '16000US2603000', '16000US4260000', '16000US4260000', '16000US4260000', '16000US4260000', '31000US11460', '31000US11460', '31000US11460', '31000US11460'], 'income': [50803.0, 48411.0, 49087.0, 49576.0, 62484.0, 59055.0, 60805.0, 61003.0, 57697.0, 55003.0, 56835.0, 55990.0, 39770.0, 37192.0, 37460.0, 38253.0, 62484.0, 59055.0, 60805.0, 61003.0], 'income_moe': [162.0, 163.0, 192.0, 186.0, 984.0, 985.0, 958.0, 901.0, 2046.0, 1688.0, 1320.0, 1259.0, 567.0, 424.0, 430.0, 511.0, 984.0, 985.0, 958.0, 901.0]}
                    df = pd.DataFrame(data)
                    
                    g = sns.catplot(x='year', y='income', data=df, kind='bar', hue='geo_name', legend=True)
                    g.fig.set_size_inches(15,8)
                    g.fig.subplots_adjust(top=0.81,right=0.86)  
                    

                    I am getting an output like shown below

                    I want to add the values of each bar on its top in K representation. For example in 2013 the bar for Michigan is at 48411 so I want to add the value 48.4K on top of that bar. Likewise for all the bars.

                    解決方案

                    Updated as of matplotlib v3.4.2

                    • Use matplotlib.pyplot.bar_label
                    • See the matplotlib: Bar Label Demo page for additional formatting options.
                    • Tested with pandas v1.2.4, which is using matplotlib as the plot engine.
                    • Use the fmt parameter for simple formats, and labels parameter for customized string formatting.
                    • See Adding value labels on a matplotlib bar chart for other plotting options related to the new method.

                    For single plot only

                    g = sns.catplot(x='year', y='income', data=df, kind='bar', hue='geo_name', legend=True)
                    g.fig.set_size_inches(15, 8)
                    g.fig.subplots_adjust(top=0.81, right=0.86)
                    
                    # extract the matplotlib axes_subplot objects from the FacetGrid
                    ax = g.facet_axis(0, 0)
                    
                    # iterate through the axes containers
                    for c in ax.containers:
                        labels = [f'{(v.get_height() / 1000):.1f}K' for v in c]
                        ax.bar_label(c, labels=labels, label_type='edge')
                    

                    For single or multiple plots

                    g = sns.catplot(x='year', y='income', data=df, kind='bar', col='geo_name', col_wrap=3, legend=True)
                    g.fig.set_size_inches(15, 8)
                    g.fig.subplots_adjust(top=0.9)
                    
                    g.fig.suptitle('Bar Count with Annotations')
                    
                    # iterate through axes
                    for ax in g.axes.ravel():
                        
                        # add annotations
                        for c in ax.containers:
                            labels = [f'{(v.get_height() / 1000):.1f}K' for v in c]
                            ax.bar_label(c, labels=labels, label_type='edge')
                        ax.margins(y=0.2)
                    
                    plt.show()
                    

                    這篇關于Seaborn Catplot 在條形圖上設置值的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                    【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  python: Two modules and classes with the same name under different packages(python:不同包下同名的兩個模塊和類)
                  Configuring Python to use additional locations for site-packages(配置 Python 以使用站點包的其他位置)
                  How to structure python packages without repeating top level name for import(如何在不重復導入頂級名稱的情況下構造python包)
                  Install python packages on OpenShift(在 OpenShift 上安裝 python 包)
                  How to refresh sys.path?(如何刷新 sys.path?)
                  Distribute a Python package with a compiled dynamic shared library(分發帶有已編譯動態共享庫的 Python 包)
                • <tfoot id='2o1dp'></tfoot>
                    <bdo id='2o1dp'></bdo><ul id='2o1dp'></ul>

                    1. <legend id='2o1dp'><style id='2o1dp'><dir id='2o1dp'><q id='2o1dp'></q></dir></style></legend>
                      1. <i id='2o1dp'><tr id='2o1dp'><dt id='2o1dp'><q id='2o1dp'><span id='2o1dp'><b id='2o1dp'><form id='2o1dp'><ins id='2o1dp'></ins><ul id='2o1dp'></ul><sub id='2o1dp'></sub></form><legend id='2o1dp'></legend><bdo id='2o1dp'><pre id='2o1dp'><center id='2o1dp'></center></pre></bdo></b><th id='2o1dp'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='2o1dp'><tfoot id='2o1dp'></tfoot><dl id='2o1dp'><fieldset id='2o1dp'></fieldset></dl></div>

                          <small id='2o1dp'></small><noframes id='2o1dp'>

                              <tbody id='2o1dp'></tbody>
                            主站蜘蛛池模板: 中文字幕在线网站 | 日韩欧美国产一区二区三区 | www黄色com| 日韩黄色影院 | 欧美成人精品一区二区三区 | 一区二区视频在线 | 懂色av懂色av粉嫩av | 国产视频一区在线观看 | 成人免费毛片果冻 | 国产精品1区 | 两性免费视频 | 午夜精品免费 | 亚洲天天 | 黄色片免费在线观看 | 中文字幕综合 | 六月丁香激情 | 国产日本在线观看 | 日本精品视频在线观看 | 日韩精品一区在线观看 | 国内av在线 | 黄色片一区二区 | 日本精品久久 | 久久一区二区视频 | 中文字幕在线视频观看 | 免费av网址在线观看 | 久久久久久久99 | 久久久精品一区二区三区 | 99精品视频免费观看 | 成人免费网站黄 | 四虎影院最新地址 | 91tv国产成人福利 | 日韩一区二区免费视频 | 蜜桃91丨九色丨蝌蚪91桃色 | 亚洲精品一区二区三区蜜桃久 | 91看片在线观看 | 国产高清91 | 午夜在线视频观看 | 亚洲伦理在线观看 | 免费在线观看www | 四虎免费在线观看 | 黄色国产视频 |