Permalink
Browse files

Created a random colour scaler

  • Loading branch information...
1 parent 3602300 commit fcf35db8d6c90fdfe13e123a6e196e8439f4b305 @orbitfold committed Jul 31, 2012
Showing with 5 additions and 3 deletions.
  1. +5 −3 pandas/tools/rplot.py
@@ -12,7 +12,7 @@
# * Expand RPlot class
#
-def random_colour(name):
+def scale_random_colour(column):
"""Random colour from a string or other hashable value.
Parameters:
@@ -23,8 +23,10 @@ def random_colour(name):
--------
(r, g, b): Where r, g, b are random numbers in the range (0, 1).
"""
- random.seed(name)
- return [random.random() for _ in range(3)]
+ def scaler(data, index):
+ random.seed(data[column].iget(index))
+ return [random.random() for _ in range(3)]
+ return scaler
def filter_column(frame, column, filter_column, filter_value):
"""Select only those values from column that have a specified value in another column.

0 comments on commit fcf35db

Please sign in to comment.