Skip to content

Commit 6babc46

Browse files
committed
Update supported-colors.md
1 parent 64c2405 commit 6babc46

File tree

1 file changed

+41
-45
lines changed

1 file changed

+41
-45
lines changed

doc/python/supported-colors.md

Lines changed: 41 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -95,54 +95,50 @@ supported_colors = ["aliceblue", "antiquewhite", "aqua", "aquamarine", "azure",
9595
"turquoise", "violet", "wheat", "white", "whitesmoke",
9696
"yellow", "yellowgreen"]
9797

98-
def display_colors_as_shapes(color_names):
99-
fig = go.Figure(layout=dict(title="Supported CSS Colors in Plotly.py"))
100-
101-
for i, color in enumerate(color_names):
102-
row, col = i // 5, i % 5
103-
x0, y0 = col * 1.2, -row * 1.2
104-
105-
fig.add_shape(
106-
type="rect",
107-
x0=x0, y0=y0,
108-
x1=x0+1, y1=y0+1,
109-
fillcolor=color,
110-
line=dict(color="black", width=1),
111-
)
112-
113-
fig.add_annotation(
114-
x=x0+0.5, y=y0-0.1,
115-
text=color,
116-
showarrow=False,
117-
font=dict(size=10)
118-
)
119-
120-
height = ((len(color_names) // 5) + (1 if len(color_names) % 5 else 0)) * 120
98+
fig = go.Figure(layout=dict(title="Supported CSS Colors in Plotly.py"))
99+
100+
for i, color in enumerate(supported_colors):
101+
row, col = i // 5, i % 5
102+
x0, y0 = col * 1.2, -row * 1.2
121103

122-
fig.update_layout(
123-
height=height,
124-
width=800,
125-
showlegend=False,
126-
plot_bgcolor='rgba(0,0,0,0)',
127-
margin=dict(l=50, r=50, t=50, b=50),
128-
xaxis=dict(
129-
showgrid=False,
130-
zeroline=False,
131-
showticklabels=False,
132-
range=[-0.5, 6]
133-
),
134-
yaxis=dict(
135-
showgrid=False,
136-
zeroline=False,
137-
showticklabels=False,
138-
scaleanchor="x",
139-
scaleratio=1,
140-
range=[-((len(color_names) // 5) + 1) * 1.2, 1.5]
141-
)
104+
fig.add_shape(
105+
type="rect",
106+
x0=x0, y0=y0,
107+
x1=x0+1, y1=y0+1,
108+
fillcolor=color,
109+
line=dict(color="black", width=0.2),
142110
)
143111

144-
return fig
112+
fig.add_annotation(
113+
x=x0+0.5, y=y0-0.1,
114+
text=color,
115+
showarrow=False,
116+
font=dict(size=10)
117+
)
118+
119+
height = ((len(supported_colors) // 5) + (1 if len(supported_colors) % 5 else 0)) * 120
120+
121+
fig.update_layout(
122+
height=height,
123+
width=800,
124+
showlegend=False,
125+
plot_bgcolor='rgba(0,0,0,0)',
126+
margin=dict(l=0, r=50, t=50, b=0),
127+
xaxis=dict(
128+
showgrid=False,
129+
zeroline=False,
130+
showticklabels=False,
131+
range=[-0.5, 6]
132+
),
133+
yaxis=dict(
134+
showgrid=False,
135+
zeroline=False,
136+
showticklabels=False,
137+
scaleanchor="x",
138+
scaleratio=1,
139+
range=[-((len(supported_colors) // 5) + 1) * 1.2, 1.5]
140+
)
141+
)
145142

146-
fig = display_colors_as_shapes(supported_colors)
147143
fig.show()
148144
```

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy