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

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

<legend id='x0825'><style id='x0825'><dir id='x0825'><q id='x0825'></q></dir></style></legend>
    • <bdo id='x0825'></bdo><ul id='x0825'></ul>

      <tfoot id='x0825'></tfoot>
      1. 将配置模式添加到 Plotly.Py 离线 - 模式栏

        Adding config modes to Plotly.Py offline - modebar(将配置模式添加到 Plotly.Py 离线 - 模式栏)
          <bdo id='enlV1'></bdo><ul id='enlV1'></ul>
          <legend id='enlV1'><style id='enlV1'><dir id='enlV1'><q id='enlV1'></q></dir></style></legend>
            1. <i id='enlV1'><tr id='enlV1'><dt id='enlV1'><q id='enlV1'><span id='enlV1'><b id='enlV1'><form id='enlV1'><ins id='enlV1'></ins><ul id='enlV1'></ul><sub id='enlV1'></sub></form><legend id='enlV1'></legend><bdo id='enlV1'><pre id='enlV1'><center id='enlV1'></center></pre></bdo></b><th id='enlV1'></th></span></q></dt></tr></i><div id='enlV1'><tfoot id='enlV1'></tfoot><dl id='enlV1'><fieldset id='enlV1'></fieldset></dl></div>

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

                  <tfoot id='enlV1'></tfoot>

                    <tbody id='enlV1'></tbody>
                • 本文介绍了将配置模式添加到 Plotly.Py 离线 - 模式栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  Plotly.js 包含配置 ModeBar 所需的所有参数,它允许人们从显示栏中获取选项(例如在线编辑图形的链接).但是,这似乎没有在 Plotly.py API 中实现.在js版本中:

                  Plotly.js includes all the parameters needed to configure the ModeBar, which allows one to take away options from the display bar (such as the link to edit the graph online). However, this does not appear implemented in the Plotly.py API. In the js version:

                  Plotly.newPlot('myDiv', data, layout, {displayModeBar: false});完全移除模式栏.
                  Plotly.newPlot('myDiv', data, layout, {displaylogo: false}, {modeBarButtonsToRemove: ['sendDataToCloud','hoverCompareCartesian']}) 允许指定要删除的每个按钮想实施.

                  Plotly.newPlot('myDiv', data, layout, {displayModeBar: false}); Removes the modebar entirely.
                  Plotly.newPlot('myDiv', data, layout, {displaylogo: false}, {modeBarButtonsToRemove: ['sendDataToCloud','hoverCompareCartesian']}) allows one to specify each button to remove which I'd like to implement.

                  我已经编辑了这个,因为我找到了一个解决方法......请参阅我在下面发布的答案.对于那些想要使用其他参数的人来说可以派上用场.

                  I've edited this as I've found a workaround... see the answer I posted below. Can come in handy for those that have other parameters that they would like to use.

                  推荐答案

                  打开 HTML 文件,搜索 modeBarButtonsToRemove:[] 然后替换为你想要删除的按钮,我的目的 modeBarButtonsToRemove:['sendDataToCloud']

                  Open the HTML file, search for modeBarButtonsToRemove:[] then replace with the buttons you want removed, for my purpose modeBarButtonsToRemove:['sendDataToCloud']

                  要删除 Plotly 徽标和链接,请搜索 displaylogo:!0 并替换为 displaylogo:!1

                  To remove the Plotly Logo and link, search for displaylogo:!0 and replace with displaylogo:!1

                  这是一个使用 Python 的演示:

                  Here is a demo using Python:

                  from plotly.offline import plot
                  import plotly.graph_objs as go
                  import webbrowser
                  import numpy as np
                  import pandas as pd
                  
                  # generate your Plotly graph here
                  
                  N = 500
                  y = np.linspace(0, 1, N)
                  x = np.random.randn(N)
                  df = pd.DataFrame({'x': x, 'y': y})
                  data = [go.Histogram(x=df['x'])]
                  
                  # plot it for offline editing
                  HTMLlink = plot(data, show_link=False, auto_open=False)[7:] #remove the junk characters
                  # now need to open the HTML file
                  with open(HTMLlink, 'r') as file :
                    tempHTML = file.read()
                  # Replace the target strings
                  tempHTML = tempHTML.replace('displaylogo:!0', 'displaylogo:!1')
                  tempHTML = tempHTML.replace('modeBarButtonsToRemove:[]', 'modeBarButtonsToRemove:["sendDataToCloud"]')
                  with open(HTMLlink, 'w') as file:
                    file.write(tempHTML)
                  del tempHTML
                  
                  webbrowser.open(HTMLlink)
                  

                  这篇关于将配置模式添加到 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 数据框制作线图?)
                  Plotly legend next to each subplot, Python(在每个子图旁边绘制图例,Python)

                      <tbody id='OGsVc'></tbody>

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

                          <tfoot id='OGsVc'></tfoot>

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