32

Is it possible to use the plotly library to create charts in python without having an online plotly account? I think the code is opensource https://github.com/plotly/plotly.py. I would like to know whether we can use this without an online account.

1

4 Answers 4

34

Yes, it can be done. The only purpose of having a plotly account is to host the graphs in your plotly account.

Plotly Offline allows you to create graphs offline and save them locally. Instead of saving the graphs to a server, your data and graphs will remain in your local system.

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

1 Comment

How to install this module plotly.offline? I've plotly installed but it doesn't have this "offline" module.
10

You can work offline without having a plotly account. The plotly version should be 1.9.x series or higher.

import numpy as np
from plotly import __version__
from plotly.offline import download_plotlyjs, init_notebook_mode, plot,iplot
print (__version__) # requires version >= 1.9.0

#Always run this the command before at the start of notebook
init_notebook_mode(connected=True)
import plotly.graph_objs as go

x=np.array([2,5,8,0,2,-8,4,3,1])
y=np.array([2,5,8,0,2,-8,4,3,1])


data = [go.Scatter(x=x,y=y)]
fig = go.Figure(data = data,layout = go.Layout(title='Offline Plotly Testing',width = 800,height = 500,
                                           xaxis = dict(title = 'X-axis'), yaxis = dict(title = 'Y-axis')))


plot(fig,show_link = False)

Your offline plotly library is setup. Reference : Plotly Offline Tutorial

This the offline graph that is created and you check the there is no online url because the graph is stored in local directory

1 Comment

@Alex Check the update of the answer and it will create a local graph in html file as shown in the image
2

You can use:

import plotly
plotly.offline.init_notebook_mode(connected=True)

To use Plotly offline.

Comments

0

The offline package is great for non-subscribed users but the figure quality is noticeably lower than the online version. This could be a problem if you want to save the figure and share with others.

1 Comment

Correction, since 3.2, offline mode supports export of high-quality images.

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.