legend
This commit is contained in:
@@ -272,7 +272,7 @@ def splitstdata(lijst):
|
||||
|
||||
from utils import (
|
||||
geo_distance,serialize_list,deserialize_list,uniqify,
|
||||
str2bool
|
||||
str2bool,range_to_color_hex
|
||||
)
|
||||
|
||||
import datautils
|
||||
@@ -3570,9 +3570,12 @@ def multiflex_view(request,userid=0,
|
||||
yerror = groups.std()[yparam]
|
||||
groupsize = groups.count()[xparam]
|
||||
|
||||
#groupsize = 15.*np.log10(1+99.*groupsize/float(max(groupsize)))
|
||||
groupsize = 30.*np.sqrt(groupsize/float(max(groupsize)))
|
||||
|
||||
if len(groupsize) == 0:
|
||||
messages.error(request,'No data in selection')
|
||||
url = reverse(user_multiflex_select)
|
||||
return HttpResponseRedirect(url)
|
||||
else:
|
||||
groupsize = 30.*np.sqrt(groupsize/float(groupsize.max()))
|
||||
|
||||
df = pd.DataFrame({
|
||||
xparam:xvalues,
|
||||
@@ -3604,16 +3607,19 @@ def multiflex_view(request,userid=0,
|
||||
if aantal == 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.
|
||||
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 = range_to_color_hex(groupcols)
|
||||
|
||||
df['color'] = colors
|
||||
|
||||
clegendx = np.arange(0,1.2,.2)
|
||||
legcolors = range_to_color_hex(clegendx)
|
||||
clegendy = df['groupval'].min()+clegendx*(df['groupval'].max()-df['groupval'].min())
|
||||
|
||||
|
||||
colorlegend = zip(range(6),clegendy,legcolors)
|
||||
|
||||
|
||||
if userid == 0:
|
||||
extratitle = ''
|
||||
else:
|
||||
@@ -3626,7 +3632,8 @@ def multiflex_view(request,userid=0,
|
||||
groupby,
|
||||
extratitle=extratitle,
|
||||
ploterrorbars=ploterrorbars,
|
||||
binsize=binsize)
|
||||
binsize=binsize,
|
||||
colorlegend=colorlegend)
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user