Private
Public Access
1
0

blue single hue color scheme

This commit is contained in:
Sander Roosendaal
2017-07-11 11:13:17 +02:00
parent 5105834873
commit 447c833fa7
2 changed files with 24 additions and 9 deletions

View File

@@ -1,3 +1,4 @@
import colorsys
from rowers.models import Workout, User, Rower, WorkoutForm,RowerForm,GraphImage from rowers.models import Workout, User, Rower, WorkoutForm,RowerForm,GraphImage
from rowingdata import rower as rrower from rowingdata import rower as rrower
from rowingdata import main as rmain from rowingdata import main as rmain
@@ -73,8 +74,6 @@ def errorbar(fig, x, y, source=ColumnDataSource(),
xerr=False, yerr=False, color='black', xerr=False, yerr=False, color='black',
point_kwargs={}, error_kwargs={}): point_kwargs={}, error_kwargs={}):
fig.circle(x, y, source=source, name='data',color=color,
**point_kwargs)
xvalues = source.data[x] xvalues = source.data[x]
yvalues = source.data[y] yvalues = source.data[y]
@@ -96,7 +95,12 @@ def errorbar(fig, x, y, source=ColumnDataSource(),
for px, py, err, color in zip(xvalues, yvalues, xerrvalues, colorvalues): for px, py, err, color in zip(xvalues, yvalues, xerrvalues, colorvalues):
x_err_x.append((px - err, px + err)) x_err_x.append((px - err, px + err))
x_err_y.append((py, py)) x_err_y.append((py, py))
err_color.append(color) (r, g, b) = tuple(int(color[i:i+2],16) for i in (1, 3, 5))
h,s,v = colorsys.rgb_to_hsv(r/255., g/255., b/255.)
v = v*0.8
r, g, b = colorsys.hsv_to_rgb(h, s, v)
color2 = "#%02x%02x%02x" % (int(255.*r), int(255.*g), int(255*b))
err_color.append(color2)
fig.multi_line(x_err_x, x_err_y, color=err_color, fig.multi_line(x_err_x, x_err_y, color=err_color,
name='xerr', name='xerr',
@@ -113,13 +117,22 @@ def errorbar(fig, x, y, source=ColumnDataSource(),
for px, py, err, color in zip(xvalues, yvalues, yerrvalues, colorvalues): for px, py, err, color in zip(xvalues, yvalues, yerrvalues, colorvalues):
y_err_x.append((px, px)) y_err_x.append((px, px))
y_err_y.append((py - err, py + err)) y_err_y.append((py - err, py + err))
err_color.append(color) (r, g, b) = tuple(int(color[i:i+2],16) for i in (1, 3, 5))
h,s,v = colorsys.rgb_to_hsv(r/255., g/255., b/255.)
v = v*0.8
r, g, b = colorsys.hsv_to_rgb(h, s, v)
color2 = "#%02x%02x%02x" % (int(255.*r), int(255.*g), int(255*b))
err_color.append(color2)
fig.multi_line(y_err_x, y_err_y, color=err_color, fig.multi_line(y_err_x, y_err_y, color=err_color,
name='yerr',**error_kwargs) name='yerr',**error_kwargs)
except TypeError: except TypeError:
pass pass
fig.circle(x, y, source=source, name='data',color=color,
**point_kwargs)
def tailwind(bearing,vwind,winddir): def tailwind(bearing,vwind,winddir):
""" Calculates head-on head/tailwind in direction of rowing """ Calculates head-on head/tailwind in direction of rowing
@@ -1292,7 +1305,7 @@ def interactive_multiflex(datadf,xparam,yparam,groupby,extratitle='',
xerr=ploterrorbars, xerr=ploterrorbars,
yerr=ploterrorbars, yerr=ploterrorbars,
point_kwargs={ point_kwargs={
'line_color':"black", 'line_color':"#969696",
'size':"groupsize", 'size':"groupsize",
'fill_color':"color", 'fill_color':"color",
}, },

View File

@@ -3604,10 +3604,12 @@ def multiflex_view(request,userid=0,
if aantal == 1: if aantal == 1:
groupcols = np.array([1.]) groupcols = np.array([1.])
# rgb = [colorsys.hsv_to_rgb(float(x/100.), 1.0, 1.0) for x in groupcols]
rgb = [colorsys.hsv_to_rgb((207-4*x)/360.,
0.06+0.89*x,
1-0.38*x) for x in groupcols]
groupcols *= 100. groupcols *= 100.
rgb = [colorsys.hsv_to_rgb(float(x/100.), 1.0, 1.0) for x in groupcols]
rgb = [colorsys.hsv_to_rgb(0.5-0.3*float(x/100.), 0.4+0.4*float(x/100.), 1.0) for x in groupcols]
# rgb = [colorsys.hsv_to_rgb(0.1+0.8*float(x/100.), 0.5, 0.5-0.2*float(x/100.)) for x in groupcols]
RGB = [(int(255.*r),int(255.*g),int(255.*b)) for (r, g, b) in rgb] RGB = [(int(255.*r),int(255.*g),int(255.*b)) for (r, g, b) in rgb]
colors = ["#%02x%02x%02x" % (r, g, b) for (r, g, b) in RGB] colors = ["#%02x%02x%02x" % (r, g, b) for (r, g, b) in RGB]
df['color'] = colors df['color'] = colors