1. <tfoot id='briqL'></tfoot>

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

      <legend id='briqL'><style id='briqL'><dir id='briqL'><q id='briqL'></q></dir></style></legend>

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

      如何在 Plotly 中启用和禁用对数刻度作为查看器?

      时间:2023-09-28
        <i id='UzCtk'><tr id='UzCtk'><dt id='UzCtk'><q id='UzCtk'><span id='UzCtk'><b id='UzCtk'><form id='UzCtk'><ins id='UzCtk'></ins><ul id='UzCtk'></ul><sub id='UzCtk'></sub></form><legend id='UzCtk'></legend><bdo id='UzCtk'><pre id='UzCtk'><center id='UzCtk'></center></pre></bdo></b><th id='UzCtk'></th></span></q></dt></tr></i><div id='UzCtk'><tfoot id='UzCtk'></tfoot><dl id='UzCtk'><fieldset id='UzCtk'></fieldset></dl></div>

          <bdo id='UzCtk'></bdo><ul id='UzCtk'></ul>
            <tbody id='UzCtk'></tbody>

            <tfoot id='UzCtk'></tfoot>

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

              • <legend id='UzCtk'><style id='UzCtk'><dir id='UzCtk'><q id='UzCtk'></q></dir></style></legend>
                本文介绍了如何在 Plotly 中启用和禁用对数刻度作为查看器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我最近在探索 Plotly,我想知道是否有一种方法可以共享绘图并让查看器在对数轴和线性轴之间切换.

                I am recently exploring Plotly and I wonder if there is a way for sharing a plot and let the viewer switch between a logarithmic axis and linear axis.

                有什么建议吗?

                推荐答案

                Plotly 有一个 dropdown 功能它允许用户动态更新绘图样式和/或正在显示的轨迹.下面是一个绘图的最小工作示例,用户可以在对数和线性刻度之间切换.

                Plotly has a dropdown feature which allows the user to dynamically update the plot styling and/or the traces being displayed. Below is a minimal working example of a plot where the user can switch between a logarithmic and linear scale.

                import plotly
                import plotly.graph_objs as go
                
                
                x = [1, 2, 3]
                y = [1000, 10000, 100000]
                y2 = [5000, 10000, 90000]
                
                trace1 = go.Bar(x=x, y=y, name='trace1')
                trace2 = go.Bar(x=x, y=y2, name='trace2', visible=False)
                
                
                data = [trace1, trace2]
                
                updatemenus = list([
                    dict(active=1,
                         buttons=list([
                            dict(label='Log Scale',
                                 method='update',
                                 args=[{'visible': [True, True]},
                                       {'title': 'Log scale',
                                        'yaxis': {'type': 'log'}}]),
                            dict(label='Linear Scale',
                                 method='update',
                                 args=[{'visible': [True, False]},
                                       {'title': 'Linear scale',
                                        'yaxis': {'type': 'linear'}}])
                            ]),
                        )
                    ])
                
                layout = dict(updatemenus=updatemenus, title='Linear scale')
                fig = go.Figure(data=data, layout=layout)
                
                plotly.offline.iplot(fig)
                

                我在 data 列表中添加了两条迹线,以显示如何在绘图中添加或删除迹线.这可以由每个 buttonupdatemenus 中的 visible 列表控制.

                I added two traces to the data list to show how traces can also be added or removed from a plot. This can be controlled by the visible list in updatemenus for each button.

                这篇关于如何在 Plotly 中启用和禁用对数刻度作为查看器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:plotly 基本示例显示 jupyter 实验室中没有绘图 下一篇:将线段添加到绘图图的简洁方法(使用 python/jupyter 笔记本)?

                相关文章

              • <legend id='Qemra'><style id='Qemra'><dir id='Qemra'><q id='Qemra'></q></dir></style></legend>

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

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

                  1. <small id='Qemra'></small><noframes id='Qemra'>