Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cufflinks for plotly: setting cufflinks config options launches

Tags:

python

plotly

I'm trying to use cufflinks locally to generate plotly graphs from a pandas Dataframe

However, when I try and configure cufflinks in a python console, it then goes into ipython mode:

>>> import cufflinks as cf
>>> cf.set_config_file(offline=True)
In :

Subsequently, when I try and generate a plot, nothing appears:

In : df.iplot(kind='bar', barmode='stack', filename='cufflinks/test')
In : 

Can cufflinks be used offline without a plotly account?

like image 241
Charon Avatar asked Mar 02 '16 11:03

Charon


People also ask

How do you install plotly cufflinks?

Installing and running plotlib and cufflinksFirst, we install these two libraries using the pip command. After installing, we import all necessary modules in our python shell or jupyter notebook. For enabling the offline mode for plotting locally in the jupyter notebook we write the below code.

How do I use Iplot in Python?

Use the . iplot() method with arguments kind (plot type), x (x-axis variable), y (y-axis variable), and mode argument removes the line connections setup by default with plotly. The plot can be zoomed in or out depending on need.


1 Answers

@elsherbini and @Charon: unfortunately I have not enough credentials to comment, so I have to write a new answer. your code pointed me into the right direction, but with the latest cufflinks version it goes even simpler:

import cufflinks as cf
df.iplot(kind='bar', barmode='stack', filename="my_barplot" , asPlot=True)

This code will generate a my_barplot.html file and open the plot in the default web browser. And this code is scriptable.

like image 112
bue Avatar answered Nov 13 '22 16:11

bue