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

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

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

        如何使用条形图缩放Seborn的y轴

        How to scale Seaborn#39;s y-axis with a bar plot(如何使用条形图缩放Seborn的y轴)
        <tfoot id='B3SQ8'></tfoot>
          <tbody id='B3SQ8'></tbody>
        <legend id='B3SQ8'><style id='B3SQ8'><dir id='B3SQ8'><q id='B3SQ8'></q></dir></style></legend>

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

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

                1. 本文介绍了如何使用条形图缩放Seborn的y轴的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在使用factorplot(kind="bar")

                  如何缩放y轴,例如使用log-scale?

                  我尝试修补曲线图的轴,但这总是以这样或那样的方式扰乱条形图,所以请先尝试您的解决方案以确保它确实有效。

                  推荐答案

                  考虑到您的问题提到的barplot,我想我也应该为该类型的绘图添加一个解决方案,因为它与@jules中的factorplot解决方案不同。

                  import random
                  import matplotlib.pyplot as plt
                  import seaborn as sns
                  sns.set(style="whitegrid")
                  
                  xs = ["First", "First", "Second", "Second", "Third", "Third"]
                  hue = ["Female", "Male"] * 3
                  ys = [1988, 301, 860, 77, 13, 1]
                  
                  g = sns.barplot(x=xs, y=ys, hue=hue)
                  g.set_yscale("log")
                  _ = g.set(xlabel="Class", ylabel="Survived")
                  

                  如果要用非对数标签标记y轴,可以执行以下操作。

                  import random
                  import matplotlib.pyplot as plt
                  import seaborn as sns
                  sns.set(style="whitegrid")
                  
                  xs = ["First", "First", "Second", "Second", "Third", "Third"]
                  hue = ["Female", "Male"] * 3
                  ys = [1988, 301, 860, 77, 13, 1]
                  
                  g = sns.barplot(x=xs, y=ys, hue=hue)
                  g.set_yscale("log")
                  
                  # the non-logarithmic labels you want
                  ticks = [1, 10, 100, 1000]
                  g.set_yticks(ticks)
                  g.set_yticklabels(ticks)
                  
                  _ = g.set(xlabel="Class", ylabel="Survived")
                  

                  这篇关于如何使用条形图缩放Seborn的y轴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 数据帧进行分组)
                2. <legend id='KMeUR'><style id='KMeUR'><dir id='KMeUR'><q id='KMeUR'></q></dir></style></legend>
                  1. <i id='KMeUR'><tr id='KMeUR'><dt id='KMeUR'><q id='KMeUR'><span id='KMeUR'><b id='KMeUR'><form id='KMeUR'><ins id='KMeUR'></ins><ul id='KMeUR'></ul><sub id='KMeUR'></sub></form><legend id='KMeUR'></legend><bdo id='KMeUR'><pre id='KMeUR'><center id='KMeUR'></center></pre></bdo></b><th id='KMeUR'></th></span></q></dt></tr></i><div id='KMeUR'><tfoot id='KMeUR'></tfoot><dl id='KMeUR'><fieldset id='KMeUR'></fieldset></dl></div>
                      <bdo id='KMeUR'></bdo><ul id='KMeUR'></ul>
                        <tbody id='KMeUR'></tbody>
                        • <tfoot id='KMeUR'></tfoot>
                        • <small id='KMeUR'></small><noframes id='KMeUR'>