@@ -13,6 +13,57 @@ def swatches(template=None):
13
13
14
14
swatches .__doc__ = _swatches .__doc__
15
15
16
+
17
+ def swatches_cyclical (template = None ):
18
+ """
19
+ Parameters
20
+ ----------
21
+ template : str or dict or plotly.graph_objects.layout.Template instance
22
+ The figure template name or definition.
23
+
24
+ Returns
25
+ -------
26
+ fig : graph_objects.Figure containing the displayed image
27
+ A `Figure` object. This figure demonstrates the color scales and
28
+ sequences in this module, as polar bar charts.
29
+ """
30
+ import plotly .graph_objects as go
31
+ from plotly .subplots import make_subplots
32
+ from plotly .express ._core import apply_default_cascade
33
+
34
+ args = dict (template = template )
35
+ apply_default_cascade (args )
36
+
37
+ rows = 2
38
+ cols = 4
39
+ scales = ["Twilight" , "IceFire" , "Edge" , "Phase" , "HSV" , "mrybm" , "mygbm" ]
40
+ fig = make_subplots (
41
+ rows = rows ,
42
+ cols = cols ,
43
+ subplot_titles = scales ,
44
+ specs = [[{"type" : "polar" }] * cols ] * rows ,
45
+ )
46
+
47
+ for i , scale in enumerate (scales ):
48
+ fig .add_trace (
49
+ go .Barpolar (
50
+ r = [1 ] * int (360 / 5 ),
51
+ theta = list (range (0 , 360 , 5 )),
52
+ marker_color = list (range (0 , 360 , 5 )),
53
+ marker_cmin = 0 ,
54
+ marker_cmax = 360 ,
55
+ marker_colorscale = scale ,
56
+ name = scale ,
57
+ ),
58
+ row = int (i / cols ) + 1 ,
59
+ col = i % cols + 1 ,
60
+ )
61
+ fig .update_traces (width = 5.2 , marker_line_width = 0 , base = 0.5 , showlegend = False )
62
+ fig .update_polars (angularaxis_visible = False , radialaxis_visible = False )
63
+ fig .update_layout (title = "plotly.colors.cyclical" , template = args ["template" ])
64
+ return fig
65
+
66
+
16
67
Twilight = [
17
68
"#e2d9e2" ,
18
69
"#9ebbc9" ,
@@ -42,7 +93,7 @@ def swatches(template=None):
42
93
"#ac2301" ,
43
94
"#820000" ,
44
95
"#4c0000" ,
45
- "#040100 " ,
96
+ "#000000 " ,
46
97
]
47
98
Edge = [
48
99
"#313131" ,
@@ -87,7 +138,7 @@ def swatches(template=None):
87
138
"#0010ff" ,
88
139
"#9700ff" ,
89
140
"#ff00bf" ,
90
- "#ff0018 " ,
141
+ "#ff0000 " ,
91
142
]
92
143
mrybm = [
93
144
"#f884f7" ,
@@ -106,6 +157,7 @@ def swatches(template=None):
106
157
"#6b4ef9" ,
107
158
"#956bfa" ,
108
159
"#cd7dfe" ,
160
+ "#f884f7" ,
109
161
]
110
162
mygbm = [
111
163
"#ef55f1" ,
@@ -124,11 +176,12 @@ def swatches(template=None):
124
176
"#6324f5" ,
125
177
"#9139fa" ,
126
178
"#c543fa" ,
179
+ "#ef55f1" ,
127
180
]
128
181
129
182
# Prefix variable names with _ so that they will not be added to the swatches
130
183
_contents = dict (globals ())
131
184
for _k , _cols in _contents .items ():
132
- if _k .startswith ("_" ) or _k == "swatches" or _k .endswith ("_r" ):
185
+ if _k .startswith ("_" ) or _k . startswith ( "swatches" ) or _k .endswith ("_r" ):
133
186
continue
134
187
globals ()[_k + "_r" ] = _cols [::- 1 ]
0 commit comments