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 中启用和禁用对数刻度作为查看器?

      How to enable and disable the logarithmic scale as a viewer in Plotly?(如何在 Plotly 中启用和禁用对数刻度作为查看器?)
        <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 中启用和禁用对数刻度作为查看器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                相关文档推荐

                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 数据框制作线图?)
                  <tbody id='Qemra'></tbody>
              • <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>
                  • <tfoot id='Qemra'></tfoot>

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

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