I have developed a 3D plot that is updated with a slider in Jupyter Notebook. I am using the following code structure:
import numpy as np
import pandas as pd
import plotly.express as px
import plotly.graph_objs as go
import plotly.offline as py
from ipywidgets import interactive, VBox
import ipywidgets as widgets
from google.colab import output
output.enable_custom_widget_manager()
dataFrame = pd.DataFrame(data, columns=objectives)
fig = go.FigureWidget(
go.Scatter3d(
x=fdf[objectives[0]],
y=fdf[objectives[1]],
z=fdf[objectives[2]],
hovertemplate= objectives[0] + " = %{x}<br>" + objectives[1] + " = %{y}<br>" + objectives[2] + " = %{z}<extra></extra>",
mode ='markers',
marker = {'color' : colors}
))
freq_slider = interactive(update_color,
obj1_w=(0, 0, 0),
obj2_w=(0, 0, 0),
obj3_w=(0, 0, 0))
vb = widgets.VBox((fig, freq_slider))
vb.layout.align_items = 'center'
vb
In Jupyter Notebook, it works perfectly... The slider updates the 3D plot, but in Colab, fig does not appear because the show() function is needed.
The following picture illustrates the 3D plot using Vbox that appears in Jupyter Notebook:
In Colab, the fig does not appear, only if I use the show() function, but it does not update when I use the slider.
Does anyone know how to plot the fig in this case? If it is not possible, is there another way to achieve the same result in Colab?
