Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Offline Bubble Chart Using Cufflinks Shows All Bubbles in One Color #443

Closed
pybokeh opened this issue Apr 16, 2016 · 1 comment
Closed

Comments

@pybokeh
Copy link

pybokeh commented Apr 16, 2016

Hello, I am using plotly.py version 1.9.7 and cufflinks version 0.7.2. When making a bubble chart, all the bubbles are the same color when I expect plotly to use different or alternating colors. Below is my code for creating offline bubble chart using cufflinks:

import pandas as pd
from plotly.offline import download_plotlyjs, init_notebook_mode, iplot
import cufflinks as cf
init_notebook_mode()


df = pd.read_csv('http://www.stat.ubc.ca/~jenny/notOcto/STAT545A/examples/gapminder/data/gapminderDataFiveYear.txt', sep='\t')
df2007 = df[df.year==2007]

iplot(df2007.iplot(asFigure=True, kind='bubble', x='gdpPercap', y='lifeExp', size='pop', text='country',
             xTitle='GDP per Capita', yTitle='Life Expectancy', dimensions=(800,600)))

When I output the data/layout data, it shows that all the bubbles are indeed given one color "rgb(255, 153, 51)". I can get the data and layout data by running this:

df2007.iplot(asFigure=True, kind='bubble', x='gdpPercap', y='lifeExp', size='pop', text='country',
         xTitle='GDP per Capita', yTitle='Life Expectancy', dimensions=(800,600))

The output is rather large, so I only paste a portion of it:
{'data': [{'marker': {'color': ['rgb(255, 153, 51)',
'rgb(255, 153, 51)',
'rgb(255, 153, 51)',
'rgb(255, 153, 51)',
'rgb(255, 153, 51)',
'rgb(255, 153, 51)',
'rgb(255, 153, 51)',
'rgb(255, 153, 51)',
'rgb(255, 153, 51)',
'rgb(255, 153, 51)',
'rgb(255, 153, 51)',
'rgb(255, 153, 51)',
'rgb(255, 153, 51)',
'rgb(255, 153, 51)',
'rgb(255, 153, 51)',
'rgb(255, 153, 51)',
'rgb(255, 153, 51)',
'rgb(255, 153, 51)',
'rgb(255, 153, 51)',
'rgb(255, 153, 51)',
'rgb(255, 153, 51)',
'rgb(255, 153, 51)',
'rgb(255, 153, 51)',
...
'layout': {'height': 600,
'legend': {'bgcolor': '#F5F6F9', 'font': {'color': '#4D5663'}},
'paper_bgcolor': '#F5F6F9',
'plot_bgcolor': '#F5F6F9',
'titlefont': {'color': '#4D5663'},
'width': 800,
'xaxis1': {'gridcolor': '#E1E5ED',
'showgrid': True,
'tickfont': {'color': '#4D5663'},
'title': 'GDP per Capita',
'titlefont': {'color': '#4D5663'},
'zerolinecolor': '#E1E5ED'},
'yaxis1': {'gridcolor': '#E1E5ED',
'showgrid': True,
'tickfont': {'color': '#4D5663'},
'title': 'Life Expectancy',
'titlefont': {'color': '#4D5663'},
'zerolinecolor': '#E1E5ED'}}}

So for some reason, plotly gives all 142 markers/bubbles just one color "rgb(255, 153, 51)". Is there a way to tell plotly to change the colors for each bubble? Perhaps this is problem on cufflinks side?

@jackparmer
Copy link
Contributor

@pybokeh Please make an issue in the cufflinks repo:
https://github.com/santosjorge/cufflinks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants