2

I'm trying to use Plotly to do a Displot for the returns for Apple stock in the past year.

import plotly.figure_factory as ff

hist_data = [df['Return'][1:]] 
group_labels = ['Apple Return distplot'] 

fig = ff.create_distplot(hist_data, group_labels, bin_size=.1)
fig.show()

And I got the following error message:

AttributeError: 'Figure' object has no attribute 'show'

How can I resolve the above issue?

3
  • What version of plotly are you using? Can you show us the output of print(plotly.__file__)? Commented Sep 4, 2019 at 16:53
  • @JohnGordon I got this message: /Users/jacquelinewong/anaconda3/lib/python3.6/site-packages/plotly/__init__.py Commented Sep 5, 2019 at 13:03
  • 2
    They have totally destroyed plotly. Nothing works for me too. Commented Sep 10, 2019 at 7:13

2 Answers 2

2

If you're seeing this error, then you're using a version of plotly lower than 4.x and you will need to upgrade. I recommended upgrading to the latest version, which is 4.1.1

Sign up to request clarification or add additional context in comments.

3 Comments

I upgraded to 4.1.1 but still got this message ImportError: The plotly.plotly module is deprecated, please install the chart-studio package and use the chart_studio.plotly module instead.
Yes, this is correct. Are you also importing from plotly.plotly? With version 4 this package moved, but it’s also no longer needed, specifically because fig.show() is the better way to show figures.
Is there any workaround, for those who cannot upgrade their plotly version?
2

This worked for me

!pip install plotly==4.1.1
from plotly import graph_objs as go

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.