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

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

    1. <legend id='Nb5Vp'><style id='Nb5Vp'><dir id='Nb5Vp'><q id='Nb5Vp'></q></dir></style></legend>

    2. Plotly:具有多个轴的分组条形图

      Plotly: Grouped Bar Chart with multiple axes(Plotly:具有多个轴的分组条形图)

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

              • 本文介绍了Plotly:具有多个轴的分组条形图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                当我在 Layout 中设置 barmode='group'trace2 = Bar(...,yaxis='y2') 时,这会导致条形图被堆叠或覆盖,而不是对它们进行分组.如何在有多个轴的情况下对条形进行分组?

                我浏览了这些但无济于事:

                • When I set barmode='group' in Layout while trace2 = Bar(...,yaxis='y2'), this leads bars to be stacked or overlayed instead of grouping them. How can I group the bars while having multiple axes?

                  I went over these but no avail:

                  • With single Y axis grouped bar chart is shown here.
                  • Multiple axes is also explained here and reference for y-axis is available here

                  解决方案

                  I hope the code below, based on zoo example, will be self-explanatory, however you have to set yaxis and offsetgroup parameters in go.Bar() object, and also yaxis2 parameter in layout parameter of go.Figure() object properly. The code is following:

                  import plotly.graph_objects as go
                  animals=['giraffes', 'orangutans', 'monkeys']
                  
                  fig = go.Figure(
                      data=[
                          go.Bar(name='SF Zoo', x=animals, y=[200, 140, 210], yaxis='y', offsetgroup=1),
                          go.Bar(name='LA Zoo', x=animals, y=[12, 18, 29], yaxis='y2', offsetgroup=2)
                      ],
                      layout={
                          'yaxis': {'title': 'SF Zoo axis'},
                          'yaxis2': {'title': 'LA Zoo axis', 'overlaying': 'y', 'side': 'right'}
                      }
                  )
                  
                  # Change the bar mode
                  fig.update_layout(barmode='group')
                  fig.show()
                  

                  The result looks like this:

                  这篇关于Plotly:具有多个轴的分组条形图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                相关文档推荐

                Adding config modes to Plotly.Py offline - modebar(将配置模式添加到 Plotly.Py 离线 - 模式栏)
                Plotly: How to style a plotly figure so that it doesn#39;t display gaps for missing dates?(Plotly:如何设置绘图图形的样式,使其不显示缺失日期的间隙?)
                python save plotly plot to local file and insert into html(python将绘图保存到本地文件并插入到html中)
                Plotly: What color cycle does plotly express follow?(情节:情节表达遵循什么颜色循环?)
                How to save plotly express plot into a html or static image file?(如何将情节表达图保存到 html 或静态图像文件中?)
                Plotly: How to make a line plot from a pandas dataframe with a long or wide format?(Plotly:如何使用长格式或宽格式的 pandas 数据框制作线图?)
              • <i id='xfHpW'><tr id='xfHpW'><dt id='xfHpW'><q id='xfHpW'><span id='xfHpW'><b id='xfHpW'><form id='xfHpW'><ins id='xfHpW'></ins><ul id='xfHpW'></ul><sub id='xfHpW'></sub></form><legend id='xfHpW'></legend><bdo id='xfHpW'><pre id='xfHpW'><center id='xfHpW'></center></pre></bdo></b><th id='xfHpW'></th></span></q></dt></tr></i><div id='xfHpW'><tfoot id='xfHpW'></tfoot><dl id='xfHpW'><fieldset id='xfHpW'></fieldset></dl></div>

                  • <bdo id='xfHpW'></bdo><ul id='xfHpW'></ul>

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

                        <tbody id='xfHpW'></tbody>
                      <legend id='xfHpW'><style id='xfHpW'><dir id='xfHpW'><q id='xfHpW'></q></dir></style></legend><tfoot id='xfHpW'></tfoot>