12

I am working locally(in my pc) just testing and learning PLOTLY 3.7.5. with anaconda env active. The code example is given by plotly

Code:

import plotly.plotly as py  # Here all begins (Look)
# import chart_studio.plotly as py  # inted of the line bellow (optional to  try)
import plotly.graph_objs as go
import pandas as pd
from datetime import datetime

if __name__ == '__main__':
    df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv')
    trace = go.Ohlc(x=df['Date'],
                    open=df['AAPL.Open'],
                    high=df['AAPL.High'],
                    low=df['AAPL.Low'],
                    close=df['AAPL.Close'])
    data = [trace]
    py.iplot(data, filename='simple_ohlc')

note (Look): I got the warning error:

'please install the chart-studio package and use the chart_studio.plotly module instead.'

Guy
  • 46,488
  • 10
  • 44
  • 88
Boris Fischman
  • 121
  • 1
  • 1
  • 3

5 Answers5

16

You need plotly's offline mode to obviate authentication - following https://stackoverflow.com/a/44694854/1021819, rather do:

from plotly.offline import iplot
jtlz2
  • 7,700
  • 9
  • 64
  • 114
4

use below line of code before hitting iplot

cf.go_offline() #will make cufflinks offline
cf.set_config_file(offline=False, world_readable=True)
jtlz2
  • 7,700
  • 9
  • 64
  • 114
2
import pandas as pd
import numpy as np
%matplotlib inline
import plotly.graph_objs as go
from  plotly.offline import plot
import chart_studio.plotly as py
import cufflinks as cf
cf.go_offline()
from plotly.offline import download_plotlyjs, init_notebook_mode, plot,iplot
init_notebook_mode(connected='true')
df = pd.DataFrame(np.random.randn(100,4),columns='A B C D'.split())
df.head()
df.iplot(kind='box')
0

Basics for starting Plotly and Cufflinks section:

import pandas as pd
import numpy as np  
%matplotlib inline  
from plotly import __version__ 
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
import cufflinks as cf
init_notebook_mode(connected=True)
cf.go_offline()
β.εηοιτ.βε
  • 33,893
  • 13
  • 69
  • 83
-3

Call these two below library automatically problem will be solved

import chart_studio.plotly as py

ZF007
  • 3,708
  • 8
  • 29
  • 48
  • 'chart_studio.plotly' is still "one" library you're importing... "as py" doesn't count as second library because its only a renaming... what is missing... – ZF007 Dec 28 '19 at 18:34