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

    1. <tfoot id='rLLio'></tfoot>
          <bdo id='rLLio'></bdo><ul id='rLLio'></ul>
      1. <legend id='rLLio'><style id='rLLio'><dir id='rLLio'><q id='rLLio'></q></dir></style></legend>
        <i id='rLLio'><tr id='rLLio'><dt id='rLLio'><q id='rLLio'><span id='rLLio'><b id='rLLio'><form id='rLLio'><ins id='rLLio'></ins><ul id='rLLio'></ul><sub id='rLLio'></sub></form><legend id='rLLio'></legend><bdo id='rLLio'><pre id='rLLio'><center id='rLLio'></center></pre></bdo></b><th id='rLLio'></th></span></q></dt></tr></i><div id='rLLio'><tfoot id='rLLio'></tfoot><dl id='rLLio'><fieldset id='rLLio'></fieldset></dl></div>
      2. 如何在海运猫图中旋转xtick标签

        How to rotate xticklabels in a seaborn catplot(如何在海运猫图中旋转xtick标签)

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

              <tbody id='OQgqy'></tbody>

            • <small id='OQgqy'></small><noframes id='OQgqy'>

            • <tfoot id='OQgqy'></tfoot>
              <legend id='OQgqy'><style id='OQgqy'><dir id='OQgqy'><q id='OQgqy'></q></dir></style></legend>
                • <bdo id='OQgqy'></bdo><ul id='OQgqy'></ul>
                  本文介绍了如何在海运猫图中旋转xtick标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我无法在Seborn/Matplotlib中旋转我的扩展标签。我尝试了许多不同的解决方案,但都不能解决它。我在堆栈溢出上看到了许多相关问题,但它们对我不起作用。

                  我当前的绘图如下所示,但是我希望xlabels旋转90度。

                      @staticmethod
                      def plotPrestasjon(plot):
                      sns.set(style="darkgrid")
                      ax = sns.catplot(x="COURSE", y="FINISH", hue="COURSE",
                                       col="BIB#", data=plot, s=9, palette="Set2")
                      ax.set(xlabel='COURSES', ylabel='FINISH (sec)')
                      plt.show()
                  

                  我已尝试:

                  ax.set_xticklabels(ax.get_xticklabels(), rotation=90)
                  

                  但这不能生成情节。你知道我怎么才能修复它吗?

                  推荐答案

                  • 根据文档,为sns.catplot设置xticklabels的正确方式是使用.set_xticklabels方法(例如g.set_xticklabels(rotation=30))。
                  • 如果需要在FacetGrid内逐个绘图进行更改,则应使用循环循环遍历Axes
                  • Building structured multi-plot grids
                  • seaborn.FacetGrid
                  • g或者在OP的情况下,axseaborn.axisgrid.FacetGrid
                    • 在迭代ax.axes.flat时,axes是一个<class 'matplotlib.axes._subplots.AxesSubplot'>,它有很多类方法,包括.get_xticklabels()
                  import seaborn as sns
                  
                  # load data
                  exercise = sns.load_dataset("exercise")
                  
                  # plot catplot
                  g = sns.catplot(x="time", y="pulse", hue="kind", col="diet", data=exercise)
                  
                  # set rotation
                  g.set_xticklabels(rotation=30)
                  

                  • 使用g.set_xticklabels(g.get_xticklabels(), rotation=30)会导致AttributeError
                  ---------------------------------------------------------------------------
                  AttributeError                            Traceback (most recent call last)
                  <ipython-input-442-d1d39d8cc4f0> in <module>
                        1 g = sns.catplot(x="time", y="pulse", hue="kind", col="diet", data=exercise)
                  ----> 2 g.set_xticklabels(g.get_xticklabels(), rotation=30)
                  
                  AttributeError: 'FacetGrid' object has no attribute 'get_xticklabels'
                  

                  这篇关于如何在海运猫图中旋转xtick标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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='C86KY'></small><noframes id='C86KY'>

                    • <bdo id='C86KY'></bdo><ul id='C86KY'></ul>
                          <tbody id='C86KY'></tbody>

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

                          • <tfoot id='C86KY'></tfoot>
                            <legend id='C86KY'><style id='C86KY'><dir id='C86KY'><q id='C86KY'></q></dir></style></legend>