• <tfoot id='5Cd57'></tfoot>
    • <bdo id='5Cd57'></bdo><ul id='5Cd57'></ul>

    <i id='5Cd57'><tr id='5Cd57'><dt id='5Cd57'><q id='5Cd57'><span id='5Cd57'><b id='5Cd57'><form id='5Cd57'><ins id='5Cd57'></ins><ul id='5Cd57'></ul><sub id='5Cd57'></sub></form><legend id='5Cd57'></legend><bdo id='5Cd57'><pre id='5Cd57'><center id='5Cd57'></center></pre></bdo></b><th id='5Cd57'></th></span></q></dt></tr></i><div id='5Cd57'><tfoot id='5Cd57'></tfoot><dl id='5Cd57'><fieldset id='5Cd57'></fieldset></dl></div>

    <small id='5Cd57'></small><noframes id='5Cd57'>

    <legend id='5Cd57'><style id='5Cd57'><dir id='5Cd57'><q id='5Cd57'></q></dir></style></legend>

      1. 旋转x轴标签快速网格海运不起作用

        Rotate x-axis labels FacetGrid seaborn not working(旋转x轴标签快速网格海运不起作用)
          <bdo id='EgI2P'></bdo><ul id='EgI2P'></ul>

          • <tfoot id='EgI2P'></tfoot>

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

              <tbody id='EgI2P'></tbody>
            <i id='EgI2P'><tr id='EgI2P'><dt id='EgI2P'><q id='EgI2P'><span id='EgI2P'><b id='EgI2P'><form id='EgI2P'><ins id='EgI2P'></ins><ul id='EgI2P'></ul><sub id='EgI2P'></sub></form><legend id='EgI2P'></legend><bdo id='EgI2P'><pre id='EgI2P'><center id='EgI2P'></center></pre></bdo></b><th id='EgI2P'></th></span></q></dt></tr></i><div id='EgI2P'><tfoot id='EgI2P'></tfoot><dl id='EgI2P'><fieldset id='EgI2P'></fieldset></dl></div>
                1. <legend id='EgI2P'><style id='EgI2P'><dir id='EgI2P'><q id='EgI2P'></q></dir></style></legend>
                2. 本文介绍了旋转x轴标签快速网格海运不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试使用python中的seborn创建多面图,但我遇到了很多问题,其中一件事是旋转x轴标签。

                  我当前正在尝试使用以下代码:

                  import pandas as pd
                  import seaborn as sns
                  import matplotlib.pyplot as plt 
                  
                  vin = pd.Series(["W1","W1","W2","W2","W1","W3","W4"])
                  word1 = pd.Series(['pdi','pdi','tread','adjust','fill','pdi','fill'])
                  word2 = pd.Series(['perform','perform','fill','measure','tire','check','tire'])
                  date = pd.Series(["01-07-2020","01-07-2020","01-07-2020","01-07-2020","01-08-2020","01-08-2020","01-08-2020"])
                  
                  bigram_with_dates = pd.concat([vin,word1,word2,date], axis = 1)
                  names = ["vin", "word1","word2","date"]
                  bigram_with_dates.columns = names
                  bigram_with_dates['date'] = pd.to_datetime(bigram_with_dates['date'])
                  bigram_with_dates['text_concat'] = bigram_with_dates['word1'] + "," + bigram_with_dates['word2']
                  
                  plot_params = sns.FacetGrid(bigram_with_dates, col="date", height=3, aspect=.5, col_wrap = 10,sharex = False, sharey = False)
                  plot = plot_params.map(sns.countplot, 'text_concat', color = 'c', order = bigram_with_dates['text_concat'])
                  plot_adjust = plot.fig.subplots_adjust(wspace=0.5, hspace=0.5)
                  
                  for axes in plot.axes.flat:
                      axes.set_xticklabels(axes.get_xticklabels(), rotation=90)
                  
                  

                  当我使用此命令时,我收到一条错误消息,指出:

                  AttributeError: 'NoneType' object has no attribute 'axes'
                  

                  ,我想我理解它的意思是没有返回的对象,所以在Nothing上设置轴不起任何作用。

                  这段代码似乎可以在我遇到的其他SO帖子中工作,但是我似乎无法让它工作。

                  如有任何关于我做错了什么的建议,我将不胜感激。

                  谢谢, 柯蒂斯

                  推荐答案

                  尝试此操作,您似乎覆盖了‘Plot’变量。:

                  import pandas as pd
                  import seaborn as sns
                  import matplotlib.pyplot as plt 
                  %matplotlib inline
                  
                  vin = pd.Series(["W1","W1","W2","W2","W1","W3","W4"])
                  word1 = pd.Series(['pdi','pdi','tread','adjust','fill','pdi','fill'])
                  word2 = pd.Series(['perform','perform','fill','measure','tire','check','tire'])
                  date = pd.Series(["01-07-2020","01-07-2020","01-07-2020","01-07-2020","01-08-2020","01-08-2020","01-08-2020"])
                  
                  bigram_with_dates = pd.concat([vin,word1,word2,date], axis = 1)
                  names = ["vin", "word1","word2","date"]
                  bigram_with_dates.columns = names
                  bigram_with_dates['date'] = pd.to_datetime(bigram_with_dates['date']).dt.strftime('%m-%d-%Y')
                  bigram_with_dates['text_concat'] = bigram_with_dates['word1'] + "," + bigram_with_dates['word2']
                  
                  plot = sns.FacetGrid(bigram_with_dates, col="date", height=3, aspect=.5, col_wrap = 10,sharex = False, sharey = False)
                  plot1 = plot.map(sns.countplot, 
                                   'text_concat', 
                                   color = 'c', 
                                   order = bigram_with_dates['text_concat'].value_counts(ascending = False).iloc[:5].index)
                              .fig.subplots_adjust(wspace=0.5, hspace=12)
                  
                  for axes in plot.axes.flat:
                      _ = axes.set_xticklabels(axes.get_xticklabels(), rotation=90)
                  plt.tight_layout()
                  

                  输出:

                  这篇关于旋转x轴标签快速网格海运不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  groupby multiple coords along a single dimension in xarray(在xarray中按单个维度的多个坐标分组)
                  Group by and Sum in Pandas without losing columns(Pandas中的GROUP BY AND SUM不丢失列)
                  Group by + New Column + Grab value former row based on conditionals(GROUP BY+新列+基于条件的前一行抓取值)
                  Groupby and interpolate in Pandas(PANDA中的Groupby算法和插值算法)
                  Pandas - Group Rows based on a column and replace NaN with non-null values(PANAS-基于列对行进行分组,并将NaN替换为非空值)
                  Grouping pandas DataFrame by 10 minute intervals(按10分钟间隔对 pandas 数据帧进行分组)

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

                          <tbody id='swlvO'></tbody>

                        <i id='swlvO'><tr id='swlvO'><dt id='swlvO'><q id='swlvO'><span id='swlvO'><b id='swlvO'><form id='swlvO'><ins id='swlvO'></ins><ul id='swlvO'></ul><sub id='swlvO'></sub></form><legend id='swlvO'></legend><bdo id='swlvO'><pre id='swlvO'><center id='swlvO'></center></pre></bdo></b><th id='swlvO'></th></span></q></dt></tr></i><div id='swlvO'><tfoot id='swlvO'></tfoot><dl id='swlvO'><fieldset id='swlvO'></fieldset></dl></div>

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

                          • <bdo id='swlvO'></bdo><ul id='swlvO'></ul>
                            <tfoot id='swlvO'></tfoot>