Skip to content

Dendrogram andrew tweaks #312

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
merged 38 commits into from
Oct 2, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
3d6dbb9
Added Dendrogram class and tests
merenlin Jul 28, 2015
2d9b88c
Added a small validator
merenlin Aug 4, 2015
819e41e
updates after renaming
merenlin Aug 4, 2015
3781906
Moved dendrogram tests to optional
merenlin Aug 12, 2015
31efa33
Protected scipy imports
merenlin Aug 12, 2015
02beb6c
Fixed typos, docstring and return value
merenlin Aug 12, 2015
bfd3cca
Typo
merenlin Aug 12, 2015
ff98cb7
Fixing default colors mapping
merenlin Aug 15, 2015
4afc8c9
Minor styling changes and fixes
merenlin Aug 15, 2015
57e15bd
pep8 and docsrings
merenlin Aug 15, 2015
b7d3d31
pep8 in tests
merenlin Aug 15, 2015
44cdece
Styling and imports
merenlin Aug 28, 2015
16c74c1
Cleanup of labels, axis and tests
merenlin Sep 1, 2015
ebff53e
Added more tests and fixed axis reference
merenlin Sep 1, 2015
0de0349
another fix for axis confusion
merenlin Sep 1, 2015
20fc40c
Added colorscale test
merenlin Sep 4, 2015
88842b1
cow comments
merenlin Sep 4, 2015
b9352d7
Merge branch 'master' into dendrogram-andrew-tweaks
theengineear Sep 30, 2015
e7bf58c
Duplicate `width` to `height` in layout update.
theengineear Sep 30, 2015
3632084
Make docs a little bit more consistent.
theengineear Sep 30, 2015
8aea12e
Spell check.
theengineear Sep 30, 2015
fae2047
pep:8ball:
theengineear Sep 30, 2015
723dde4
pep:8ball:
theengineear Sep 30, 2015
806a6e0
`autoscale` —> `autosize`
theengineear Sep 30, 2015
ca08777
Add a `NumpyTestUtilsMixin` to help dict comps.
theengineear Sep 30, 2015
8866e34
Show that the dendrogram test should have failed!
theengineear Sep 30, 2015
d0b0f6a
Fix dendrogram test, lock down *entire* figure.
theengineear Sep 30, 2015
fc7ce40
Merge branch 'dendrogram-andrew-tweaks' of https://github.com/plotly/…
theengineear Sep 30, 2015
bed3bec
Lock down `test_dendrogram_random_matrix` test.
theengineear Sep 30, 2015
f3b57fc
Fix duplicated `test_dendrogram_orientation` test.
theengineear Sep 30, 2015
3cf13ae
Lock down `test_dendrogram_orientation_two` spec.
theengineear Sep 30, 2015
dab5d37
Rename `.._orientation_two` —> `.._colorscale`.
theengineear Sep 30, 2015
89592cd
PY3 fix. Can’t index a `.keys()` view.
theengineear Sep 30, 2015
3e3de24
Loosen `dtype` on constructor in test. (PY3 fail).
theengineear Sep 30, 2015
76361e6
Rename test suite for figure factory.
theengineear Sep 30, 2015
85dccd1
Merge branch 'master' into dendrogram-andrew-tweaks
theengineear Oct 1, 2015
01d2826
For consistency use Fixed and Added in changelog.
theengineear Oct 1, 2015
3815a8f
version bump —> 1.8.7 (added dendrogram)
theengineear Oct 1, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,15 @@ This project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

## [1.8.7] - 2015-10-01
### Added
- The FigureFactory can now create dendrogram plots with `.create_dendrogram`.

## [1.8.6] - 2015-09-28
### Fixed
- Saving "world_readable" to your config file via `plotly.tools.set_config` actually works.

### Added
- You can also save `auto_open` and `sharing` to the config file so that you can forget these
keyword argument in `py.iplot` and `py.plot`.

Expand Down
1 change: 0 additions & 1 deletion plotly/tests/test_core/test_tools/test_figure_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import datetime
from nose.tools import raises

import plotly.tools as tls
from plotly.exceptions import PlotlyError
from plotly.graph_objs import graph_objs
Expand Down
82 changes: 82 additions & 0 deletions plotly/tests/test_optional/optional_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,93 @@
import matplotlib
# Force matplotlib to not use any Xwindows backend.
matplotlib.use('Agg')

import numpy as np

from plotly.matplotlylib import Exporter, PlotlyRenderer
from plotly.tests.utils import is_num_list
from plotly.utils import get_by_path, node_generator


def run_fig(fig):
renderer = PlotlyRenderer()
exporter = Exporter(renderer)
exporter.run(fig)
return renderer


class NumpyTestUtilsMixin(object):
"""Provides some helper functions to make testing easier."""

def _format_path(self, path):
str_path = [repr(p) for p in path]
return '[' + ']['.join(sp for sp in str_path) + ']'

def assert_dict_equal(self, d1, d2, msg=None):
"""
Uses `np.allclose()` on number arrays.

:raises: (AssertionError) Using TestCase's self.failureException

"""
self.assertIsInstance(d1, dict, 'First argument is not a dictionary')
self.assertIsInstance(d2, dict, 'Second argument is not a dictionary')

for node, path in node_generator(d1):

# first check that this sub-dict is contained in both dicts
try:
comp_node = get_by_path(d2, path)
except (KeyError, IndexError):
standard_msg = (
'Path {} exists in dict 1, but not dict 2.'
.format(path)
)
self.fail(self._formatMessage(msg, standard_msg))
self.assertIsInstance(
comp_node, dict, 'Value at path {} is not a dict.'.format(path)
)

# check that each key in the first is contained in the second
for key, val in node.items():
if isinstance(val, dict):
continue # this gets tested as its own node

# check that the values at this key are equal
val_path = path + (key, )
try:
comp_val = comp_node[key]
except KeyError:
standard_msg = (
'Path {} exists in dict 1, but not dict 2.'
.format(self._format_path(val_path))
)
self.fail(self._formatMessage(msg, standard_msg))

if (isinstance(val, np.ndarray) or
isinstance(comp_val, np.ndarray)):
if np.array_equal(val, comp_val):
continue
elif val == comp_val:
continue

if is_num_list(val) and is_num_list(comp_val):
if np.allclose(val, comp_val):
continue

standard_msg = (
'Value comparison failed at path {}.\n'
'{} != {}'
.format(self._format_path(val_path), val, comp_val)
)
self.fail(self._formatMessage(msg, standard_msg))

# finally, check that keys in the second are in the first
for key in comp_node:
val_path = path + (key, )
if key not in node:
standard_msg = (
'Path {} exists in dict 2, but not dict 1.'
.format(self._format_path(val_path))
)
self.fail(self._formatMessage(msg, standard_msg))
Loading