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

    1. <legend id='doqZ5'><style id='doqZ5'><dir id='doqZ5'><q id='doqZ5'></q></dir></style></legend>
        • <bdo id='doqZ5'></bdo><ul id='doqZ5'></ul>

        Seborn FactGrid子图的一个共享x轴标签(布局/间距?)

        One shared x-axis label for Seaborn FacetGrid subplots (layouts/spacing?)(Seborn FactGrid子图的一个共享x轴标签(布局/间距?))
      1. <legend id='eAQAi'><style id='eAQAi'><dir id='eAQAi'><q id='eAQAi'></q></dir></style></legend>
          • <bdo id='eAQAi'></bdo><ul id='eAQAi'></ul>
            <tfoot id='eAQAi'></tfoot>

                    <tbody id='eAQAi'></tbody>
                1. <small id='eAQAi'></small><noframes id='eAQAi'>

                  <i id='eAQAi'><tr id='eAQAi'><dt id='eAQAi'><q id='eAQAi'><span id='eAQAi'><b id='eAQAi'><form id='eAQAi'><ins id='eAQAi'></ins><ul id='eAQAi'></ul><sub id='eAQAi'></sub></form><legend id='eAQAi'></legend><bdo id='eAQAi'><pre id='eAQAi'><center id='eAQAi'></center></pre></bdo></b><th id='eAQAi'></th></span></q></dt></tr></i><div id='eAQAi'><tfoot id='eAQAi'></tfoot><dl id='eAQAi'><fieldset id='eAQAi'></fieldset></dl></div>
                  本文介绍了Seborn FactGrid子图的一个共享x轴标签(布局/间距?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想为x轴添加一个标签,为y轴添加一个标签。

                  此外,如果让颜色栏标题离颜色栏多一点空间的提示,我们将不胜感激。

                  我已通过# <---- Help Please!

                  标记了需要帮助的位置
                  # this chunk seems to be necessary for plotting in my virtualenv. 
                  import matplotlib
                  matplotlib.use('TkAgg')
                  % matplotlib inline
                  
                  import matplotlib.pyplot as plt
                  import pandas as pd
                  import numpy as np
                  import itertools
                  import seaborn as sns
                  
                  import platform
                  
                  print("python version {}".format(platform.python_version()))
                  # python version 3.5.1
                  print("seaborn version {}".format(sns.__version__))
                  # seaborn version 0.7.0
                  
                  methods=['method 1', 'method2', 'method 3', 'method 4']
                  times = range(0, 100, 10)
                  data = pd.DataFrame(list(
                          itertools.product(methods, times, times)))
                  data.columns = ['method','x var', 'y var']
                  data['x var'] = data['x var']*10
                  data['score'] = np.random.sample(data.shape[0])
                  print(data.head())
                  
                  def facet_heatmap(data, color, **kws):
                      data = data.pivot(index='y var', columns='x var', 
                                        values='score')
                      # Pass kwargs to heatmap
                      sns.heatmap(data, cmap='summer', **kws)  
                  
                  with sns.plotting_context(font_scale=5.5):
                      g = sns.FacetGrid(data, col="method", col_wrap=2, 
                                        size=3, aspect=1)
                  
                  # Create a colorbar axes
                  cbar_ax = g.fig.add_axes([.96, .3, .02, .4], 
                                           title='could use 
                   more space')  # <---- Help Please!
                  
                  # Specify the colorbar axes and limits
                  g = g.map_dataframe(facet_heatmap,
                                      cbar_ax=cbar_ax,
                                      vmin=0, vmax=1)  
                  
                  # add a supertitle, you bet.
                  plt.subplots_adjust(top=0.85)
                  supertitle = "This is a supertitle, you bet."
                  g.fig.suptitle(supertitle, size=18)
                  
                  # rotate x labels
                  g.set_xticklabels(rotation=90)
                  
                  g.set_titles(col_template="{col_name}", 
                               fontweight='bold', fontsize=18)
                  g.fig.subplots_adjust(right=.9)  # Add space so the colorbar doesn't overlap the plot
                  
                  # ---- add one label for x axis and one for y-axis -----
                  
                  g.fig.text(0.4, 0.1, s='way too high!',fontdict={'fontsize':16})  # <---- Help Please!
                  plt.figtext(0.4,0.02,"this looks bad",fontdict={'fontsize':16})  # <---- Help Please!
                  # add y-axis label too      [enter image description here][1]# <---- Help Please! 
                  

                  注意:我是在this post的基础上构建的,并且添加了一些方便的功能,如字幕、旋转的x标签和色条标题。

                  推荐答案

                  根据@mwaskom的评论,您必须使用g.fig.text()添加标签,并使用g.fig.subplots_adjust()在左侧和底部添加空格以避免重叠。

                  这篇关于Seborn FactGrid子图的一个共享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不丢失列)
                  Is there a way of group by month in Pandas starting at specific day number?( pandas 有从特定日期开始的按月分组的方式吗?)
                  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替换为非空值)
                2. <small id='LdOMM'></small><noframes id='LdOMM'>

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

                      <tbody id='LdOMM'></tbody>
                      <bdo id='LdOMM'></bdo><ul id='LdOMM'></ul>
                    • <tfoot id='LdOMM'></tfoot>