Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Distplot #275

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

Merged
cldougl merged 19 commits into master from distplot
Sep 17, 2015
Merged

Distplot #275

cldougl merged 19 commits into master from distplot
Sep 17, 2015

Conversation

@cldougl
Copy link
Member

@cldougl cldougl commented Aug 5, 2015

  • add distplot to FigureFactory
  • add validate_displot() method to tools.py
  • add core tests for distplot parameters

cldougl added 9 commits August 4, 2015 17:58
- Plotly version of seaborn.distplot to add to FigureFactory
- plots histogram, curve (kde or normal), and rugplot
- add `validate_displot()` method to tools.py
- add core tests for distplot parameters
- add protected import of scipy to tools.py
- add distplot checks to tests_optional
- add scipy.stats
- edit examples in docstring
- all distplot tests are depending on scipy
Copy link
Member Author

cldougl commented Aug 5, 2015

@chriddyp @theengineear @aneda @etpinard
Hey everyone, here's a draft of the distplot (http://stanford.edu/~mwaskom/software/seaborn/generated/seaborn.distplot.html) FigureFactory addition.
One issue though - I'm not sure if the 'protected import' of scipy I tried is how we want to add it / correct in general- the tests won't pass on circle.

Copy link
Member

chriddyp commented Aug 6, 2015

@cldougl from the Circle error:

======================================================================
ERROR: test_distplot_more_args (plotly.tests.test_optional.test_opt_tracefactory.TestDistplot)
----------------------------------------------------------------------
Traceback (most recent call last):
 File "/home/ubuntu/python-api/plotly/tests/test_optional/test_opt_tracefactory.py", line 109, in test_distplot_more_args
 show_rug=False, bin_size=.2)
 File "/home/ubuntu/python-api/plotly/tools.py", line 2418, in create_distplot
 FigureFactory.validate_distplot(hist_data, curve_type)
 File "/home/ubuntu/python-api/plotly/tools.py", line 1541, in validate_distplot
 raise ImportError("FigureFactory.create_distplot requires scipy")
ImportError: FigureFactory.create_distplot requires scipy

it looks like our Circle build doesn't have scipy. Circle will only build the packages that we explicitly configure. Here is the circle configuration file: https://github.com/plotly/python-api/blob/master/circle.yml#L7, note the "optional-requirements.txt" reference. if you add scipy to that file: https://github.com/plotly/python-api/blob/master/optional-requirements.txt, then circle should build it and tests should pass

Copy link
Member Author

cldougl commented Aug 6, 2015

ahh thank you @chriddyp !!

Copy link
Contributor

@theengineear theengineear Aug 7, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\o/

Copy link
Contributor

@theengineear theengineear Aug 24, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this is going to be a merge conflict with #274 . I guess we'll need to have some specific requirements specified... How about a syntax like:

_scipy_imported
_scipy__spatial_imported
_scipy__cluster__hierarchy_imported

I'm not sure which is going to land first, but the latter will have to implement this.

cldougl added 2 commits August 7, 2015 13:10
- DRYing type validation
- fix over-indentation
plotly/tools.py Outdated
Copy link
Contributor

@theengineear theengineear Aug 24, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pep:8ball: spaces around operators

Copy link
Contributor

@cldougl awesome! I'm ok with 💃 this. I'd like to let @chriddyp check over it again too though.

plotly/tools.py Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we make these guys hidden? (by adding a _). there's hardly anything I like more than seeing the minimal number of functions in the ipython tab-tab helper:
image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we reverse the legend? That way way the rugs will be displayed in the same order as the legend entries. Right now they're in opposite orders
image

Copy link
Member

otherwise, sweet!

- hide validate functions from tab-tab helper
- add pandas example and pandas type to validation
- replace `**kwargs` with `rug_text` and `colors` in
- updated the docstring with Andrew’s nice terse suggestions
- hid tick label from rug plot
- modified rug_text so its indexed across datasets, not copied
- edited examples
 - added import numpy where needed
 - increased sample sizes
- reversed legend
- fix the show_legend issue so a legend is shown if the hist is hidden
- add test to test_core to check exception for `scipy_import = False`
- edit tests in test optional to reflect the changes (mentioned above)
made
- scipy will currently import in test_core
Copy link
Member Author

cldougl commented Sep 14, 2015

@chriddyp can I merge this?

Copy link
Member

Looking good! It doesn't look like the colors argument is working for me:

import plotly.plotly as py
from plotly.tools import FigureFactory as FF
import numpy as np
x1 = np.random.randn(200)
x2 = np.random.randn(200)+1
x3 = np.random.randn(200)-1
x4 = np.random.randn(200)+2
hist_data = [x1] + [x2] + [x3] + [x4]
group_labels = ['2012', '2013', '2014', '2015']
fig = FF.create_distplot(
 hist_data, group_labels, curve_type='normal',
 bin_size=.2, colors=['yellow', 'pink', 'grey', 'aqua'])
iplot(fig)

image

Copy link
Member

Thx for fixing! All good by me now 💃 Can you add some python examples as ipython notebooks to /documentation?

Copy link
Member Author

cldougl commented Sep 17, 2015

Thanks! yep doc's ready

cldougl added a commit that referenced this pull request Sep 17, 2015
@cldougl cldougl merged commit 2a22483 into master Sep 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /