@@ -38,8 +38,11 @@ class Velocity(Layer):
3838 Used to align color scale.
3939 velocity_scale: float, 0.005
4040 To be modified for particle animations.
41- color_scale: array, default []
42- Array of hex/rgb colors for user-specified color scale.
41+ branca.colormap.LinearColorMap instance, default linear.OrRd_06
42+ The colormap used for displaying the Velocity data
43+ _color_scale: array, default []
44+ Array of hex/rgb colors for user-specified color scale, it is private and defined from the colormap.
45+
4346 """
4447
4548 _view_name = Unicode ('LeafletVelocityView' ).tag (sync = True )
@@ -67,45 +70,16 @@ class Velocity(Layer):
6770 min_velocity = Float (0 ).tag (sync = True , o = True )
6871 max_velocity = Float (10 ).tag (sync = True , o = True )
6972 velocity_scale = Float (0.005 ).tag (sync = True , o = True )
70- colormap = Any (linear .YlOrRd_04 )
71- #color_scale = List([]).tag(sync=True, o=True)
72- colors = [
73- "rgb(36,104, 180)" ,
74- "rgb(60,157, 194)" ,
75- "rgb(128,205,193)" ,
76- "rgb(151,218,168)" ,
77- "rgb(198,231,181)" ,
78- "rgb(238,247,217)" ,
79- "rgb(255,238,159)" ,
80- "rgb(252,217,125)" ,
81- "rgb(255,182,100)" ,
82- "rgb(252,150,75)" ,
83- "rgb(250,112,52)" ,
84- "rgb(245,64,32)" ,
85- "rgb(237,45,28)" ,
86- "rgb(220,24,32)" ,
87- "rgb(180,0,35)"
88- ]
89- color_scale = List (colors ).tag (sync = True , o = True )
73+ colormap = Any (linear .OrRd_06 )
74+ _color_scale = List ([]).tag (sync = True , o = True )
9075
91- @default ('color_scale ' )
76+ @default ('_color_scale ' )
9277 def _default_color_scale (self ):
93- self .color_scale = []
94-
95- for color in self .colormap .colors :
96- rgb_tuple = tuple (int (x * 256 ) for x in color [:3 ])
97- rgb_str = f"rgb{ rgb_tuple } "
98- self .color_scale .append (rgb_str )
99-
100- return self .color_scale
101-
102- @default ('colormap' )
103- def _default_colormap (self ):
104-
78+ self ._color_scale = []
10579
10680 for color in self .colormap .colors :
10781 rgb_tuple = tuple (int (x * 256 ) for x in color [:3 ])
10882 rgb_str = f"rgb{ rgb_tuple } "
109- self .color_scale .append (rgb_str )
83+ self ._color_scale .append (rgb_str )
11084
111- return self .color_scale
85+ return self ._color_scale
0 commit comments