From e7b9ba4c244ceb7755436ab032223d5e3d54fad7 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Tue, 15 Dec 2020 12:57:44 +0100 Subject: [PATCH] fix #593 updated colormap --- rowers/interactiveplots.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/rowers/interactiveplots.py b/rowers/interactiveplots.py index cf113ddb..6be3294a 100644 --- a/rowers/interactiveplots.py +++ b/rowers/interactiveplots.py @@ -368,7 +368,7 @@ def interactive_hr_piechart(df,rower,title,totalseconds=0): z.wedge(x=0,y=1, radius=0.4, start_angle=cumsum('angle',include_zero=True), end_angle=cumsum('angle'), - line_color='white',fill_color='color',source=data,legend='zone') + line_color='white',fill_color='color',source=data,legend_group='zone') @@ -424,6 +424,7 @@ def interactive_workouttype_piechart(workouts): data = pd.DataFrame(data) + data['color'] = data['type'].apply(lambda x:mapcolors(x)) data['totaltime'] = data['value'].apply(lambda x:pretty_timedelta(x)) try: @@ -439,7 +440,7 @@ def interactive_workouttype_piechart(workouts): p.wedge(x=0, y=1, radius=0.4, start_angle=cumsum('angle', include_zero=True), end_angle=cumsum('angle'), - line_color="white", fill_color='color', source=data,legend='type', ) + line_color="white", fill_color='color', source=data,legend_group='type', ) p.axis.axis_label=None p.axis.visible=False @@ -697,7 +698,7 @@ def interactive_activitychart(workouts,startdate,enddate,stack='type',toolbar_lo bars=table.to.bars(['date',stack],[yaxis]) bars.opts( - opts.Bars(color=hv.Cycle('Category10'), show_legend=True, stacked=True, + opts.Bars(color=dim_expr, show_legend=True, stacked=True, tools=['tap','hover'], width=550, xrotation=45,padding=(0,(0,.1)), legend_position='bottom',show_frame=True)) @@ -860,11 +861,11 @@ def interactive_activitychart2(workouts,startdate,enddate,stack='type',toolbar_l df = pd.DataFrame(thedict) - - source = ColumnDataSource(df) + df['color'] = df['type'].apply(lambda x:mapcolors(x)) df.sort_values('date_sorting',inplace=True) #clrs = hv.Cycle(df['colors'].values) + source = ColumnDataSource(df) hv.extension('bokeh') @@ -876,7 +877,7 @@ def interactive_activitychart2(workouts,startdate,enddate,stack='type',toolbar_l bars=table.to.bars(['date',stack],[yaxis]) bars.opts( - opts.Bars(color=dim_expr, show_legend=True, stacked=True, + opts.Bars(cmap=mytypes.color_map, show_legend=True, stacked=True, tools=['tap','hover'], width=550, xrotation=45,padding=(0,(0,.1)), legend_position='bottom',show_frame=True))