From f8cdf9501e4c2d4117e22f34532127958f5e272d Mon Sep 17 00:00:00 2001 From: Liam Connors Date: Thu, 3 Apr 2025 12:59:59 -0400 Subject: [PATCH 1/3] Remove deprecated append_trace from docs --- doc/python/3d-axes.md | 4 ++-- doc/python/histograms.md | 18 +++++++++--------- doc/python/horizontal-bar-charts.md | 14 +++++++------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/doc/python/3d-axes.md b/doc/python/3d-axes.md index b6ec1d8d3e0..e6ea8414032 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/histograms.md b/doc/python/histograms.md index 78eab471933..aca2c25b3d5 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 ae9b02e3d30..9454b5f07bb 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! From efda7d81413642bc0cf6a2d605be8db78555eedd Mon Sep 17 00:00:00 2001 From: Liam Connors Date: Thu, 3 Apr 2025 13:01:20 -0400 Subject: [PATCH 2/3] remove deprecated append_trace --- doc/python/subplots.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/python/subplots.md b/doc/python/subplots.md index 6842a650b50..b5711ee5de8 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) From 267fd7cd92494c62328ffa9e2dc251ac5a1960ee Mon Sep 17 00:00:00 2001 From: Liam Connors Date: Thu, 3 Apr 2025 13:12:17 -0400 Subject: [PATCH 3/3] update docstring --- plotly/subplots.py | 2 +- plotly/tools.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plotly/subplots.py b/plotly/subplots.py index 0ee6a654776..7a03afb5e0a 100644 --- a/plotly/subplots.py +++ b/plotly/subplots.py @@ -218,7 +218,7 @@ def make_subplots( >>> fig.add_scatter(y=[1, 3, 2], row=2, col=1) # doctest: +ELLIPSIS Figure(...) - or see Figure.append_trace + or see Figure.add_trace Example 2: diff --git a/plotly/tools.py b/plotly/tools.py index 4a4a6e136d4..1a29bf81791 100644 --- a/plotly/tools.py +++ b/plotly/tools.py @@ -249,7 +249,7 @@ def make_subplots( fig['data'] += [Scatter(x=[1,2,3], y=[2,1,2])] fig['data'] += [Scatter(x=[1,2,3], y=[2,1,2], xaxis='x2', yaxis='y2')] - # or see Figure.append_trace + # or see Figure.add_trace Example 2: # subplots with shared x axes