diff --git a/.circleci/config.yml b/.circleci/config.yml index 3b36cc4802..14b14a0230 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -61,9 +61,9 @@ commands: cd js npm ci npm run build - + - when: - condition: + condition: not: equal: - <> @@ -315,6 +315,8 @@ jobs: name: Install dependencies command: | cd doc + sudo apt-get update + sudo apt-get install rename curl -LsSf https://astral.sh/uv/install.sh | sh uv venv source .venv/bin/activate diff --git a/doc/python/3d-axes.md b/doc/python/3d-axes.md index b6ec1d8d3e..e6ea841403 100644 --- a/doc/python/3d-axes.md +++ b/doc/python/3d-axes.md @@ -6,7 +6,7 @@ jupyter: extension: .md format_name: markdown format_version: '1.3' - jupytext_version: 1.15.1 + jupytext_version: 1.16.4 kernelspec: display_name: Python 3 (ipykernel) language: python @@ -114,7 +114,7 @@ fig = make_subplots(rows=2, cols=2, print_grid=False) for i in [1,2]: for j in [1,2]: - fig.append_trace( + fig.add_trace( go.Mesh3d( x=(60*np.random.randn(N)), y=(25*np.random.randn(N)), diff --git a/doc/python/bar-charts.md b/doc/python/bar-charts.md index f16955a93b..543b1563e3 100644 --- a/doc/python/bar-charts.md +++ b/doc/python/bar-charts.md @@ -124,7 +124,7 @@ import plotly.express as px df = px.data.gapminder().query("continent == 'Oceania'") fig = px.bar(df, x='year', y='pop', hover_data=['lifeExp', 'gdpPercap'], color='country', - labels={'pop':'population of Canada'}, height=400) + labels={'pop':'population of Oceania'}, height=400) fig.show() ``` diff --git a/doc/python/histograms.md b/doc/python/histograms.md index 78eab47193..aca2c25b3d 100644 --- a/doc/python/histograms.md +++ b/doc/python/histograms.md @@ -6,9 +6,9 @@ jupyter: extension: .md format_name: markdown format_version: '1.3' - jupytext_version: 1.14.1 + jupytext_version: 1.16.4 kernelspec: - display_name: Python 3 + display_name: Python 3 (ipykernel) language: python name: python3 language_info: @@ -20,7 +20,7 @@ jupyter: name: python nbconvert_exporter: python pygments_lexer: ipython3 - version: 3.8.8 + version: 3.11.10 plotly: description: How to make Histograms in Python with Plotly. display_as: statistical @@ -438,12 +438,12 @@ trace5 = go.Histogram(x=x, autobinx = False ) -fig.append_trace(trace0, 1, 1) -fig.append_trace(trace1, 1, 2) -fig.append_trace(trace2, 2, 1) -fig.append_trace(trace3, 2, 2) -fig.append_trace(trace4, 3, 1) -fig.append_trace(trace5, 3, 2) +fig.add_trace(trace0, 1, 1) +fig.add_trace(trace1, 1, 2) +fig.add_trace(trace2, 2, 1) +fig.add_trace(trace3, 2, 2) +fig.add_trace(trace4, 3, 1) +fig.add_trace(trace5, 3, 2) fig.show() ``` diff --git a/doc/python/horizontal-bar-charts.md b/doc/python/horizontal-bar-charts.md index ae9b02e3d3..9454b5f07b 100644 --- a/doc/python/horizontal-bar-charts.md +++ b/doc/python/horizontal-bar-charts.md @@ -5,10 +5,10 @@ jupyter: text_representation: extension: .md format_name: markdown - format_version: '1.1' - jupytext_version: 1.1.1 + format_version: '1.3' + jupytext_version: 1.16.4 kernelspec: - display_name: Python 3 + display_name: Python 3 (ipykernel) language: python name: python3 language_info: @@ -20,7 +20,7 @@ jupyter: name: python nbconvert_exporter: python pygments_lexer: ipython3 - version: 3.6.7 + version: 3.11.10 plotly: description: How to make horizontal bar charts in Python with Plotly. display_as: basic @@ -239,7 +239,7 @@ x = ['Japan', 'United Kingdom', 'Canada', 'Netherlands', fig = make_subplots(rows=1, cols=2, specs=[[{}, {}]], shared_xaxes=True, shared_yaxes=False, vertical_spacing=0.001) -fig.append_trace(go.Bar( +fig.add_trace(go.Bar( x=y_saving, y=x, marker=dict( @@ -252,7 +252,7 @@ fig.append_trace(go.Bar( orientation='h', ), 1, 1) -fig.append_trace(go.Scatter( +fig.add_trace(go.Scatter( x=y_net_worth, y=x, mode='lines+markers', line_color='rgb(128, 0, 128)', @@ -335,4 +335,4 @@ fig.show() ### Reference -See more examples of bar charts and styling options [here](https://plotly.com/python/bar-charts/).
See https://plotly.com/python/reference/bar/ for more information and chart attribute options! \ No newline at end of file +See more examples of bar charts and styling options [here](https://plotly.com/python/bar-charts/).
See https://plotly.com/python/reference/bar/ for more information and chart attribute options! diff --git a/doc/python/subplots.md b/doc/python/subplots.md index 6842a650b5..b5711ee5de 100644 --- a/doc/python/subplots.md +++ b/doc/python/subplots.md @@ -6,9 +6,9 @@ jupyter: extension: .md format_name: markdown format_version: '1.3' - jupytext_version: 1.14.1 + jupytext_version: 1.16.4 kernelspec: - display_name: Python 3 + display_name: Python 3 (ipykernel) language: python name: python3 language_info: @@ -20,7 +20,7 @@ jupyter: name: python nbconvert_exporter: python pygments_lexer: ipython3 - version: 3.8.8 + version: 3.11.10 plotly: description: How to make subplots in with Plotly's Python graphing library. Examples of stacked, custom-sized, gridded, and annotated subplots. @@ -80,17 +80,17 @@ import plotly.graph_objects as go fig = make_subplots(rows=3, cols=1) -fig.append_trace(go.Scatter( +fig.add_trace(go.Scatter( x=[3, 4, 5], y=[1000, 1100, 1200], ), row=1, col=1) -fig.append_trace(go.Scatter( +fig.add_trace(go.Scatter( x=[2, 3, 4], y=[100, 110, 120], ), row=2, col=1) -fig.append_trace(go.Scatter( +fig.add_trace(go.Scatter( x=[0, 1, 2], y=[10, 11, 12] ), row=3, col=1) diff --git a/doc/python/supported-colors.md b/doc/python/supported-colors.md new file mode 100644 index 0000000000..53fd7b3aec --- /dev/null +++ b/doc/python/supported-colors.md @@ -0,0 +1,142 @@ +--- +jupyter: + jupytext: + notebook_metadata_filter: all + text_representation: + extension: .md + format_name: markdown + format_version: '1.3' + jupytext_version: 1.17.0 + kernelspec: + display_name: Python 3 (ipykernel) + language: python + name: python3 + language_info: + codemirror_mode: + name: ipython + version: 3 + file_extension: .py + mimetype: text/x-python + name: python + nbconvert_exporter: python + pygments_lexer: ipython3 + version: 3.13.2 + plotly: + description: A list of supported named CSS Colors + display_as: file_settings + language: python + layout: base + name: Supported CSS Colors + order: 40 + page_type: example_index + permalink: python/css-colors/ + thumbnail: thumbnail/shape.jpg +--- + +# Supported CSS Colors + +Many properties in Plotly.py for configuring colors support named CSS colors. For example, marker colors: + +```python +import plotly.graph_objects as go + +fig = go.Figure([ + go.Bar( + x=['Jan', 'Feb', 'Mar', 'Apr'], + y=[20, 14, 25, 16], + name='Primary Product', + # Named CSS color + marker_color='royalblue' + ) +]) + +fig.show() +``` + +These colors are supported in Plotly.py when a property accepts a [named CSS color](https://developer.mozilla.org/en-US/docs/Web/CSS/named-color). + +```python hide_code=true +import plotly.graph_objects as go +import pandas as pd + +supported_colors = ["aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", + "beige", "bisque", "black", "blanchedalmond", "blue", + "blueviolet", "brown", "burlywood", "cadetblue", + "chartreuse", "chocolate", "coral", "cornflowerblue", + "cornsilk", "crimson", "cyan", "darkblue", "darkcyan", + "darkgoldenrod", "darkgray", "darkgrey", "darkgreen", + "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", + "darkorchid", "darkred", "darksalmon", "darkseagreen", + "darkslateblue", "darkslategray", "darkslategrey", + "darkturquoise", "darkviolet", "deeppink", "deepskyblue", + "dimgray", "dimgrey", "dodgerblue", "firebrick", + "floralwhite", "forestgreen", "fuchsia", "gainsboro", + "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", + "greenyellow", "honeydew", "hotpink", "indianred", "indigo", + "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", + "lemonchiffon", "lightblue", "lightcoral", "lightcyan", + "lightgoldenrodyellow", "lightgray", "lightgrey", + "lightgreen", "lightpink", "lightsalmon", "lightseagreen", + "lightskyblue", "lightslategray", "lightslategrey", + "lightsteelblue", "lightyellow", "lime", "limegreen", + "linen", "magenta", "maroon", "mediumaquamarine", + "mediumblue", "mediumorchid", "mediumpurple", + "mediumseagreen", "mediumslateblue", "mediumspringgreen", + "mediumturquoise", "mediumvioletred", "midnightblue", + "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", + "oldlace", "olive", "olivedrab", "orange", "orangered", + "orchid", "palegoldenrod", "palegreen", "paleturquoise", + "palevioletred", "papayawhip", "peachpuff", "peru", "pink", + "plum", "powderblue", "purple", "red", "rosybrown", + "royalblue", "rebeccapurple", "saddlebrown", "salmon", + "sandybrown", "seagreen", "seashell", "sienna", "silver", + "skyblue", "slateblue", "slategray", "slategrey", "snow", + "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", + "turquoise", "violet", "wheat", "white", "whitesmoke", + "yellow", "yellowgreen"] + +fig = go.Figure(layout=dict(title="Supported Named CSS Colors")) + +for i, color in enumerate(supported_colors): + row, col = i // 5, i % 5 + x0, y0 = col * 1.2, -row * 1.2 + + fig.add_shape( + type="rect", + x0=x0, y0=y0, + x1=x0+1, y1=y0+1, + fillcolor=color, + line=dict(color="black", width=0.2), + ) + + fig.add_annotation( + x=x0+0.5, y=y0-0.1, + text=color, + showarrow=False, + font=dict(size=10) + ) + +fig.update_layout( + height=((len(supported_colors) // 5) + (1 if len(supported_colors) % 5 else 0)) * 120, + width=800, + showlegend=False, + plot_bgcolor='rgba(0,0,0,0)', + margin=dict(l=50, r=50, t=50, b=50), + xaxis=dict( + showgrid=False, + zeroline=False, + showticklabels=False, + range=[-0.5, 6] + ), + yaxis=dict( + showgrid=False, + zeroline=False, + showticklabels=False, + scaleanchor="x", + scaleratio=1, + range=[-((len(supported_colors) // 5) + 1) * 1.2, 1.5] + ) +) + +fig.show() +```