<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:具有多个轴的分组条形图

      时间:2023-09-28

        <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:具有多个轴的分组条形图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:plotly.offline.iplot 在 Jupyter Notebook/Lab 中提供一个大的空白字段作为其输出 下一篇:Plotly:如何在桑基图中设置节点位置?

                相关文章

              • <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'>

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