You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Plotly Graph Objects绘制OHLC图表报错求助

问题:Plotly OHLC图表无法正常显示,报错
  • 不确定如何解决该问题,搜索后未找到有效帮助
  • 最初使用CSV文件运行代码时出现错误,改用测试数据后问题依旧

以下是测试代码:

import plotly.graph_objects as go
ohlc1 = go.Ohlc(x=['2000-01-01', '2000-01-02', '2000-01-03', '2000-010-04'],
            open=[101,111,121,131],
            high=[102,112,122.132],
            low=[103,113,123,133],
            close=[104,114,124,134],
            name='OHLC')
layout = go.Layout(
title='BTC-USD OHLC Data with Monowaves',
xaxis=dict(title='Date', rangeslider=dict(visible=False)),
yaxis=dict(title='Price (USD)')
)
ohlc1 = go.Ohlc(x=['2000-01-01', '2000-01-02', '2000-01-03', '2000-010-04'],
            open=[101,111,121,131],
            high=[102,112,122.132],
            low=[103,113,123,133],
            close=[104,114,124,134],
            name='OHLC')

fig1 = go.Figure(data=ohlc1, layout=layout)
fig1.show()

运行代码后,浏览器显示报错界面,无法正常加载图表。


2024年5月19日更新

按照建议添加以下调试代码:

print("Available Renderers: " , pio.renderers)
print("Default Renderer: ", pio.renderers.default)

错误仍存在,调试输出如下:

Available Renderers: Renderers configuration

Default renderer: 'browser'
Available renderers:
    ['plotly_mimetype', 'jupyterlab', 'nteract', 'vscode',
      'notebook', 'notebook_connected', 'kaggle', 'azure', 'colab',
     'cocalc', 'databricks', 'json', 'png', 'jpeg', 'jpg', 'svg',
     'pdf', 'browser', 'firefox', 'chrome', 'chromium', 'iframe',
     'iframe_connected', 'sphinx_gallery', 'sphinx_gallery_png']

Default Renderer: browser

恳请各位提供帮助,谢谢!


内容的提问来源于stack exchange,提问作者user3129015

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.23 17:37:25