-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Violin #471
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
Violin #471
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
651e725
Changed tools.py
Kully b4eb690
Updated tools.py again
Kully 2530527
...
Kully 85710a6
Improved tools.py
Kully 352d233
First PR for Violin: colorscaling, visible colorscale, all color-type...
Kully e29e7d3
Updated default-schema
Kully bde9a7c
Updated color parsing functions
Kully 4257ed6
Added changes
Kully b0ff4d2
...
Kully 06d685d
added more things
Kully 13b5ba7
more
Kully a69c4bd
Violin with qualitative colors//updated tests
Kully a6ce8e3
re-did tests
Kully 9a20ece
Add a description line
Kully d3059e0
added tests//added group labels to plots//edited main doc string
Kully ce6f83a
Added/updated doc string examples
Kully 164a9c6
accurate colorscale max/min labels
Kully 4abec6e
Made error messages more legible
Kully 6bd112b
Moved PLOTLY_SCALES to top of file
Kully 5900590
...
Kully 11da292
..
Kully 536ab35
wrote method for dealing with different color formats (eg. list, tupl...
Kully 4904ac5
added color_parser function//removed dictionary capbilities
Kully d0f55cf
Replaced DEFAULT_FILLCOLOR with fillcolor param in functions
Kully 4a954e1
Merged master into Violin
Kully d319448
Made tests compatible with color_parser code
Kully 303385d
Replaced new color_parser function into scatterplot_theme
Kully c24b374
Removed commented out code and removed brackets from 'if colors[index...
Kully File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
wrote method for dealing with different color formats (eg. list, tupl...
...e, str, etc)
- Loading branch information
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2267,6 +2267,30 @@ def _find_intermediate_color(lowcolor, highcolor, intermed): | |
| lowcolor[2] + intermed * diff_2) | ||
| return inter_colors | ||
|
|
||
| @staticmethod | ||
| def _color_parser(colors, function): | ||
| """ | ||
| Takes color(s) and a function and applys the function on the color(s) | ||
|
|
||
| In particular, this function identifies whether the given color object | ||
| is an iterable or not and applies the given color-parsing function to | ||
| the color or iterable of colors | ||
|
|
||
| """ | ||
| if hasattr(colors[0], '__iter__') or isinstance(colors[0], str): | ||
| if isinstance(colors, tuple): | ||
| new_color_tuple = ( | ||
| function(colors[0]), | ||
| function(colors[1]), | ||
| function(colors[2]) | ||
| ) | ||
| return new_color_tuple | ||
| for index, color in enumerate(colors): | ||
| colors[index] = function(color) | ||
| return colors | ||
| else: | ||
| return function(colors) | ||
|
|
||
| @staticmethod | ||
| def _unconvert_from_RGB_255(colors): | ||
| """ | ||
|
|
@@ -2277,24 +2301,11 @@ def _unconvert_from_RGB_255(colors): | |
| a value between 0 and 1 | ||
|
|
||
| """ | ||
| if isinstance(colors, tuple): | ||
| un_rgb_color = (colors[0]/(255.0), | ||
| colors[1]/(255.0), | ||
| colors[2]/(255.0)) | ||
|
|
||
| un_rgb_color = (colors[0]/(255.0), | ||
| colors[1]/(255.0), | ||
| colors[2]/(255.0)) | ||
|
|
||
| return un_rgb_color | ||
|
|
||
| if isinstance(colors, list): | ||
| un_rgb_colors = [] | ||
| for color in colors: | ||
| un_rgb_color = (color[0]/(255.0), | ||
| color[1]/(255.0), | ||
| color[2]/(255.0)) | ||
|
|
||
| un_rgb_colors.append(un_rgb_color) | ||
|
|
||
| return un_rgb_colors | ||
| return un_rgb_color | ||
|
|
||
| @staticmethod | ||
| def _map_z2color(zval, colormap, vmin, vmax): | ||
|
|
@@ -3082,7 +3093,6 @@ def _scatterplot_theme(dataframe, headers, diag, size, height, width, | |
| c_indx += 1 | ||
| trace_list.append(unique_index_vals) | ||
| legend_param += 1 | ||
| #return trace_list | ||
|
|
||
| trace_index = 0 | ||
| indices = range(1, dim + 1) | ||
|
|
@@ -3606,22 +3616,10 @@ def _endpts_to_intervals(endpts): | |
| @staticmethod | ||
| def _convert_to_RGB_255(colors): | ||
| """ | ||
| Return a (list of) tuple(s) where each element is multiplied by 255 | ||
|
|
||
| Takes a tuple or a list of tuples where each element of each tuple is | ||
| between 0 and 1. Returns the same tuple(s) where each tuple element is | ||
| multiplied by 255 | ||
| Multiplies each element of a triplet by 255 | ||
| """ | ||
|
|
||
| if isinstance(colors, tuple): | ||
| return (colors[0]*255.0, colors[1]*255.0, colors[2]*255.0) | ||
|
|
||
| else: | ||
| colors_255 = [] | ||
| for color in colors: | ||
| rgb_color = (color[0]*255.0, color[1]*255.0, color[2]*255.0) | ||
| colors_255.append(rgb_color) | ||
| return colors_255 | ||
| return (colors[0]*255.0, colors[1]*255.0, colors[2]*255.0) | ||
|
|
||
| @staticmethod | ||
| def _n_colors(lowcolor, highcolor, n_colors): | ||
|
|
@@ -3652,24 +3650,9 @@ def _n_colors(lowcolor, highcolor, n_colors): | |
| @staticmethod | ||
| def _label_rgb(colors): | ||
| """ | ||
| Takes tuple(s) (a, b, c) and returns rgb color(s) 'rgb(a, b, c)' | ||
|
|
||
| Takes either a list or a single color tuple of the form (a, b, c) and | ||
| returns the same color(s) with each tuple replaced by a string | ||
| 'rgb(a, b, c)' | ||
|
|
||
| Takes tuple (a, b, c) and returns an rgb color 'rgb(a, b, c)' | ||
| """ | ||
| if isinstance(colors, tuple): | ||
| return ('rgb(%s, %s, %s)' % (colors[0], colors[1], colors[2])) | ||
| else: | ||
| colors_label = [] | ||
| for color in colors: | ||
| color_label = ('rgb(%s, %s, %s)' % (color[0], | ||
| color[1], | ||
| color[2])) | ||
| colors_label.append(color_label) | ||
|
|
||
| return colors_label | ||
| return ('rgb(%s, %s, %s)' % (colors[0], colors[1], colors[2])) | ||
|
|
||
| @staticmethod | ||
| def _unlabel_rgb(colors): | ||
|
|
@@ -3680,52 +3663,25 @@ def _unlabel_rgb(colors): | |
| such colors and returns the color tuples in tuple(s) (a, b, c) | ||
|
|
||
| """ | ||
| if isinstance(colors, str): | ||
| str_vals = '' | ||
| for index in range(len(colors)): | ||
| try: | ||
| float(colors[index]) | ||
| str_vals = '' | ||
| for index in range(len(colors)): | ||
| try: | ||
| float(colors[index]) | ||
| str_vals = str_vals + colors[index] | ||
| except ValueError: | ||
| if (colors[index] == ',') or (colors[index] == '.'): | ||
|
||
| str_vals = str_vals + colors[index] | ||
| except ValueError: | ||
| if (colors[index] == ',') or (colors[index] == '.'): | ||
| str_vals = str_vals + colors[index] | ||
|
|
||
| str_vals = str_vals + ',' | ||
| numbers = [] | ||
| str_num = '' | ||
| for char in str_vals: | ||
| if char != ',': | ||
| str_num = str_num + char | ||
| else: | ||
| numbers.append(float(str_num)) | ||
| str_num = '' | ||
| return (numbers[0], numbers[1], numbers[2]) | ||
|
|
||
| if isinstance(colors, list): | ||
| unlabelled_colors = [] | ||
| for color in colors: | ||
| str_vals = '' | ||
| for index in range(len(color)): | ||
| try: | ||
| float(color[index]) | ||
| str_vals = str_vals + color[index] | ||
| except ValueError: | ||
| if (color[index] == ',') or (color[index] == '.'): | ||
| str_vals = str_vals + color[index] | ||
|
|
||
| str_vals = str_vals + ',' | ||
| numbers = [] | ||
| str_vals = str_vals + ',' | ||
| numbers = [] | ||
| str_num = '' | ||
| for char in str_vals: | ||
| if char != ',': | ||
| str_num = str_num + char | ||
| else: | ||
| numbers.append(float(str_num)) | ||
| str_num = '' | ||
| for char in str_vals: | ||
| if char != ',': | ||
| str_num = str_num + char | ||
| else: | ||
| numbers.append(float(str_num)) | ||
| str_num = '' | ||
| unlabelled_tuple = (numbers[0], numbers[1], numbers[2]) | ||
| unlabelled_colors.append(unlabelled_tuple) | ||
|
|
||
| return unlabelled_colors | ||
| return (numbers[0], numbers[1], numbers[2]) | ||
|
|
||
| @staticmethod | ||
| def create_scatterplotmatrix(df, dataframe=None, headers=None, | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.