cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Plotly error while plotting into ipywidget output on Databricks

mk3
New Contributor II

Hello, while plotting into databricks notebook with plotly into ipywidget output, I am getting following error SyntaxError: expected expression, got ','. Here is my snippet.

 

 

 

import ipywidgets, random
import plotly.express as px
from plotly.offline import plot
from IPython.display import display, clear_output

out = ipywidgets.Output()
button = ipywidgets.Button(description = 'button')

def on_button_clicked(b):
    with out:
        clear_output(True)
        p = plot( px.scatter(x = [random.randint(1, 100) for i in range(4)], y = [random.randint(1, 100) for i in range(4)]), output_type='div')
        displayHTML(p)

button.on_click(on_button_clicked)
display(button)
out

 

 

 

 

 

1 REPLY 1

mk3
New Contributor II

Hi, you are right. It seems that figurewidget is the only option, if we need to plot into ipywidgets.

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group