This topic was addressed in other questions but none of the recommendations worked in my case.
I have macOS M1
#Manage the data
import pandas as pd
import numpy as np
#Graphic tools
import matplotlib
import matplotlib.pyplot as plt
import plotly.figure_factory as ff
from plotly.figure_factory import create_gantt
from datetime import date
# Make data for chart
df = [dict(Task="Job A", Start='2009-01-01',
Finish='2009-02-30', Complete=10),
dict(Task="Job B", Start='2009-03-05',
Finish='2009-04-15', Complete=60),
dict(Task="Job C", Start='2009-02-20',
Finish='2009-05-30', Complete=95)]
# Create a figure with Plotly colorscale
fig = create_gantt(df, colors='Blues', index_col='Complete',
show_colorbar=True, bar_width=0.5,
showgrid_x=True, showgrid_y=True)
fig.show()
After running the code (Jupiter notebook), there are no errors. However, it is just a blank output cell. Nothing to see.
I checked ALL previous answers. Unfortunately nothing works so far.
the use of jupyter labextension install jupyterlab-plotly does not work because lab extension is deprecated according to my output.
Totally confused. matplotlib works fine with other programs on the same notebook.
UPDATE:
I tried this and it worked:
import plotly.express as px
fig = px.bar(x=["a", "b", "c"], y=[1, 3, 2])
import plotly.graph_objects as go
fig_widget = go.FigureWidget(fig)
fig_widget
So there is a situation that just plotly does not work in MY system (while it does in other configs - see Trenton's response) BUT with it works with graph_objects.
What do you suggest?
UPDATE
it worked after I added two last lines of code. Still it must have worked with show()
# Make data for chart
import plotly.express as px
df = [dict(Task="Job A", Start='2009-01-01',
Finish='2009-02-30', Complete=10),
dict(Task="Job B", Start='2009-03-05',
Finish='2009-04-15', Complete=60),
dict(Task="Job C", Start='2009-02-20',
Finish='2009-05-30', Complete=95)]
# Create a figure with Plotly colorscale
fig2 = create_gantt(df, colors='Blues', index_col='Complete',
show_colorbar=True, bar_width=0.5,
showgrid_x=True, showgrid_y=True)
#fig2.show()
fig_widget2 = go.FigureWidget(fig2)
fig_widget2