Skip to content

Commit

Permalink
Coloring works now?
Browse files Browse the repository at this point in the history
Can't distinguish numbers from different columns if the color keyword is
overridden. Will see if maybe we can do shapes?
  • Loading branch information
chengeaa committed Feb 10, 2017
1 parent b96cb44 commit 0c71fb8
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 7 deletions.
20 changes: 18 additions & 2 deletions datascience/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -1923,6 +1923,18 @@ def to_array(self):
(0.298, 0.235, 0.216),
)

scatter_colors = (
(0.0, 0.102, 0.267),
(1.0, 0.784, 0.0),
(1.0, 0.0, 0.0),
(0.702, 0.612, 0.302),
(0.463, 0.537, 0.282),
(0.024, 0.482, 0.761),
(0.984, 0.314, 0.071),
(0.098, 0.22, 0.122),
(0.298, 0.235, 0.216),
)

default_alpha = 0.7

default_options = {
Expand Down Expand Up @@ -2176,8 +2188,12 @@ def scatter(self, column_for_x, select=None, overlay=True, fit_line=False,
def draw(axis, label, color):
if colors is not None:

n = len(np.unique(np.array(colors)))
color = list(itertools.islice(itertools.cycle(self.chart_colors), n))
parts = np.unique(np.array(self.column(colors)))
colorset = list(itertools.islice(itertools.cycle(self.scatter_colors), len(parts)))
mapping = {}
for i, part in enumerate(parts):
mapping[part] = colorset[i]
color = [mapping[i] for i in self.column(colors)]
# color = self[colors]
elif 'color' in options:
color = options.pop('color')
Expand Down

0 comments on commit 0c71fb8

Please sign in to comment.