pythonplotlyplotly.graph-objects

incorrect plotly graph object output error


I am not sure how to address this. i tried searching but not did not find much help.

here is my code. I first ran this code with csv file and i was getting the same error. Then i tried with the following data and once again the same error.

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()

upon running this code, i get the following screen.

Browser Output Screenshot

appreciate any help. Thank you !!

Edited: 19-05-2024 I edited the code as follows following @Tarik advise.

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

The error still persists, and the debug output is as follows:

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


Solution

  • You need to ensure you are using the correct renderer. Example to set the renderer to be the browser:

    import plotly.io as pio
    pio.renderers.default = 'browser'
    

    To show available renderers:

    print(pio.renderers)
    

    To show the current default renderer:

    print(pio.renderers.default)