@@ -13,6 +13,57 @@ def swatches(template=None):
1313
1414swatches .__doc__ = _swatches .__doc__
1515
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+
1667Twilight = [
1768 "#e2d9e2" ,
1869 "#9ebbc9" ,
@@ -42,7 +93,7 @@ def swatches(template=None):
4293 "#ac2301" ,
4394 "#820000" ,
4495 "#4c0000" ,
45- "#040100 " ,
96+ "#000000 " ,
4697]
4798Edge = [
4899 "#313131" ,
@@ -87,7 +138,7 @@ def swatches(template=None):
87138 "#0010ff" ,
88139 "#9700ff" ,
89140 "#ff00bf" ,
90- "#ff0018 " ,
141+ "#ff0000 " ,
91142]
92143mrybm = [
93144 "#f884f7" ,
@@ -106,6 +157,7 @@ def swatches(template=None):
106157 "#6b4ef9" ,
107158 "#956bfa" ,
108159 "#cd7dfe" ,
160+ "#f884f7" ,
109161]
110162mygbm = [
111163 "#ef55f1" ,
@@ -124,11 +176,12 @@ def swatches(template=None):
124176 "#6324f5" ,
125177 "#9139fa" ,
126178 "#c543fa" ,
179+ "#ef55f1" ,
127180]
128181
129182# Prefix variable names with _ so that they will not be added to the swatches
130183_contents = dict (globals ())
131184for _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" ):
133186 continue
134187 globals ()[_k + "_r" ] = _cols [::- 1 ]
0 commit comments