@@ -33,43 +33,27 @@ jupyter:
|
33 | 33 | thumbnail: null
|
34 | 34 | ---
|
35 | 35 |
|
36 |
| -<!-- #region --> |
37 |
| -# Colors and Fonts |
| 36 | +# Supported CSS Colors |
38 | 37 |
|
39 |
| - |
40 |
| -## Supported CSS Colors |
41 |
| - |
42 |
| -Named CSS colors are supported |
43 |
| -<!-- #endregion --> |
| 38 | +Many properties in Plotly.py for configuring colors support named CSS colors. For example, marker colors: |
44 | 39 |
|
45 | 40 | ```python
|
46 | 41 | import plotly.graph_objects as go
|
47 | 42 |
|
48 |
| -months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', |
49 |
| -'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] |
50 |
| - |
51 |
| -fig = go.Figure() |
52 |
| -fig.add_trace(go.Bar( |
53 |
| -x=months, |
54 |
| -y=[20, 14, 25, 16, 18, 22, 19, 15, 12, 16, 14, 17], |
55 |
| -name='Primary Product', |
56 |
| -marker_color='indianred' |
57 |
| -)) |
58 |
| -fig.add_trace(go.Bar( |
59 |
| -x=months, |
60 |
| -y=[19, 14, 22, 14, 16, 19, 15, 14, 10, 12, 12, 16], |
61 |
| -name='Secondary Product', |
62 |
| -marker_color='lightsalmon' |
63 |
| -)) |
64 |
| - |
65 |
| -# Here we modify the tickangle of the xaxis, resulting in rotated labels. |
66 |
| -fig.update_layout(barmode='group', xaxis_tickangle=-45) |
| 43 | +fig = go.Figure([ |
| 44 | +go.Bar( |
| 45 | +x=['Jan', 'Feb', 'Mar', 'Apr'], |
| 46 | +y=[20, 14, 25, 16], |
| 47 | +name='Primary Product', |
| 48 | +# Named CSS color |
| 49 | +marker_color='indianred' |
| 50 | +) |
| 51 | +]) |
| 52 | + |
67 | 53 | fig.show()
|
68 | 54 | ```
|
69 | 55 |
|
70 |
| -The following named CSS colors are supported in Plotly.py |
71 |
| - |
72 |
| -and can be used anywhere a color property accepts a named CSS color. For example, a color property on font.. |
| 56 | +The following CSS colors are supported in Plotly.py when a property accepts a named CSS color: |
73 | 57 |
|
74 | 58 | ```python hide_code=true
|
75 | 59 | import plotly.graph_objects as go
|
@@ -162,9 +146,3 @@ def display_colors_as_shapes(color_names):
|
162 | 146 | fig = display_colors_as_shapes(supported_colors)
|
163 | 147 | fig.show()
|
164 | 148 | ```
|
165 |
| - |
166 |
| -## Supported Fonts |
167 |
| - |
168 |
| -```python |
169 |
| - |
170 |
| -``` |
0 commit comments