From 642c15a9350538dc4d92ffe7002ab2f39f599171 Mon Sep 17 00:00:00 2001 From: SeanMcCarren Date: Wed, 25 May 2022 09:48:37 +0200 Subject: [PATCH 01/14] Remove errroneous comma in SVG path This is only a minor mistake, but slightly misleading because for a moment I thought this example showed how to draw only some but not all edges. --- doc/python/shapes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/python/shapes.md b/doc/python/shapes.md index 7b10116489e..bb72c854193 100644 --- a/doc/python/shapes.md +++ b/doc/python/shapes.md @@ -565,7 +565,7 @@ fig.update_layout( # filled Polygon dict( type="path", - path=" M 3,7 L2,8 L2,9 L3,10, L4,10 L5,9 L5,8 L4,7 Z", + path=" M 3,7 L2,8 L2,9 L3,10 L4,10 L5,9 L5,8 L4,7 Z", fillcolor="PaleTurquoise", line_color="LightSeaGreen", ), From c0c1632e1692ab66cb6e8654d7b1374654f809bb Mon Sep 17 00:00:00 2001 From: "Connor D. Pierce" Date: Thu, 23 Jun 2022 15:41:40 -0500 Subject: [PATCH 02/14] Fix for Python "Custom Buttons" doc page --- doc/python/custom-buttons.md | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/doc/python/custom-buttons.md b/doc/python/custom-buttons.md index 014dc8ad2e4..9bf94f3f383 100644 --- a/doc/python/custom-buttons.md +++ b/doc/python/custom-buttons.md @@ -392,24 +392,32 @@ fig.add_trace( line=dict(color="#F06A6A", dash="dash"))) # Add Annotations and Buttons -high_annotations = [dict(x="2016-03-01", +high_annotations = [dict(x=-0.05, y=df.High.mean(), - xref="x", yref="y", - text="High Average:
%.2f" % df.High.mean(), - ax=0, ay=-40), + xanchor="right", + yanchor="bottom", + xref="x domain", + yref="y", + text="High Avg:
%.2f" % df.High.mean(), + showarrow=False), dict(x=df.High.idxmax(), y=df.High.max(), - xref="x", yref="y", + xref="x", + yref="y", text="High Max:
%.2f" % df.High.max(), ax=0, ay=-40)] -low_annotations = [dict(x="2015-05-01", +low_annotations = [dict(x=-0.05, y=df.Low.mean(), - xref="x", yref="y", - text="Low Average:
%.2f" % df.Low.mean(), - ax=-40, ay=40), - dict(x=df.High.idxmin(), + xanchor="right", + yanchor="top", + xref="x domain", + yref="y", + text="Low Avg:
%.2f" % df.Low.mean(), + showarrow=False), + dict(x=df.Low.idxmin(), y=df.Low.min(), - xref="x", yref="y", + xref="x", + yref="y", text="Low Min:
%.2f" % df.Low.min(), ax=0, ay=40)] From 15cd598b8bfe72e6e842b5d1426c493241ad56da Mon Sep 17 00:00:00 2001 From: "Connor D. Pierce" Date: Thu, 23 Jun 2022 15:57:35 -0500 Subject: [PATCH 03/14] Replace hex colors with nice colors --- doc/python/custom-buttons.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/python/custom-buttons.md b/doc/python/custom-buttons.md index 9bf94f3f383..10f3ab07e2a 100644 --- a/doc/python/custom-buttons.md +++ b/doc/python/custom-buttons.md @@ -369,27 +369,27 @@ fig.add_trace( go.Scatter(x=list(df.index), y=list(df.High), name="High", - line=dict(color="#33CFA5"))) + line=dict(color="MediumSlateBlue"))) fig.add_trace( go.Scatter(x=list(df.index), y=[df.High.mean()] * len(df.index), name="High Average", visible=False, - line=dict(color="#33CFA5", dash="dash"))) + line=dict(color="MediumSlateBlue", dash="dash"))) fig.add_trace( go.Scatter(x=list(df.index), y=list(df.Low), name="Low", - line=dict(color="#F06A6A"))) + line=dict(color="DarkOrange"))) fig.add_trace( go.Scatter(x=list(df.index), y=[df.Low.mean()] * len(df.index), name="Low Average", visible=False, - line=dict(color="#F06A6A", dash="dash"))) + line=dict(color="DarkOrange", dash="dash"))) # Add Annotations and Buttons high_annotations = [dict(x=-0.05, From 4c91abcace143966ee13ef6567c08da59bafd553 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 30 Jan 2023 10:05:51 -0500 Subject: [PATCH 04/14] made moving-point-on-a-curve faster proposed by empet on the forum --- doc/python/animations.md | 43 ++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/doc/python/animations.md b/doc/python/animations.md index ffd948c7064..cabb764fde3 100644 --- a/doc/python/animations.md +++ b/doc/python/animations.md @@ -145,9 +145,7 @@ fig.show() ```python import plotly.graph_objects as go - import numpy as np - # Generate curve data t = np.linspace(-1, 1, 100) x = t + t ** 2 @@ -156,7 +154,7 @@ xm = np.min(x) - 1.5 xM = np.max(x) + 1.5 ym = np.min(y) - 1.5 yM = np.max(y) + 1.5 -N = 50 +N = 25 s = np.linspace(-1, 1, N) xx = s + s ** 2 yy = s - s ** 2 @@ -167,26 +165,29 @@ fig = go.Figure( data=[go.Scatter(x=x, y=y, mode="lines", line=dict(width=2, color="blue")), - go.Scatter(x=x, y=y, - mode="lines", - line=dict(width=2, color="blue"))], - layout=go.Layout( + go.Scatter(x=[xx[0]], y=[yy[0]], + mode="markers", + marker=dict(color="red", size=10))]) +fig.update_layout(width=600, height=450, xaxis=dict(range=[xm, xM], autorange=False, zeroline=False), yaxis=dict(range=[ym, yM], autorange=False, zeroline=False), - title_text="Kinematic Generation of a Planar Curve", hovermode="closest", - updatemenus=[dict(type="buttons", - buttons=[dict(label="Play", - method="animate", - args=[None])])]), - frames=[go.Frame( - data=[go.Scatter( - x=[xx[k]], - y=[yy[k]], - mode="markers", - marker=dict(color="red", size=10))]) - - for k in range(N)] -) + title_text="Kinematic Generation of a Planar Curve", title_x=0.5, + updatemenus = [dict(type = "buttons", + buttons = [ + dict( + args = [None, {"frame": {"duration": 10, "redraw": False}, + "fromcurrent": True, "transition": {"duration": 10}}], + label = "Play", + method = "animate", + + )])]) + +fig.update(frames=[go.Frame( + data=[go.Scatter( + x=[xx[k]], + y=[yy[k]])], + traces=[1]) # fig.data[1] is updated by each frame + for k in range(N)]) fig.show() ``` From d64871d70f68a182a8f707e4ca902c3dbcac2ddd Mon Sep 17 00:00:00 2001 From: behloolsabir Date: Thu, 9 Feb 2023 10:44:21 +0000 Subject: [PATCH 05/14] Update ml-roc-pr.md AUC for PR curve needs precision and recall as their input. fpr and tpr would be appropriate input for ROC curve. --- doc/python/ml-roc-pr.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/python/ml-roc-pr.md b/doc/python/ml-roc-pr.md index f6f9ee0c6ee..20678b8ca82 100644 --- a/doc/python/ml-roc-pr.md +++ b/doc/python/ml-roc-pr.md @@ -216,7 +216,7 @@ precision, recall, thresholds = precision_recall_curve(y, y_score) fig = px.area( x=recall, y=precision, - title=f'Precision-Recall Curve (AUC={auc(fpr, tpr):.4f})', + title=f'Precision-Recall Curve (AUC={auc(recall, precision):.4f})', labels=dict(x='Recall', y='Precision'), width=700, height=500 ) From 58fef6612ee3b0c396ab050508341ad0ec2e05c0 Mon Sep 17 00:00:00 2001 From: yuji96 Date: Wed, 5 Apr 2023 11:28:26 +0900 Subject: [PATCH 06/14] align center annotations in donut pies --- doc/python/pie-charts.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/python/pie-charts.md b/doc/python/pie-charts.md index 8564822091e..2d0a6db1f19 100644 --- a/doc/python/pie-charts.md +++ b/doc/python/pie-charts.md @@ -235,8 +235,10 @@ fig.update_traces(hole=.4, hoverinfo="label+percent+name") fig.update_layout( title_text="Global Emissions 1990-2011", # Add annotations in the center of the donut pies. - annotations=[dict(text='GHG', x=0.18, y=0.5, font_size=20, showarrow=False), - dict(text='CO2', x=0.82, y=0.5, font_size=20, showarrow=False)]) + annotations=[dict(text='GHG', x=sum(fig.get_subplot(1, 1).x) / 2, y=0.5, + font_size=20, showarrow=False, xanchor="center"), + dict(text='CO2', x=sum(fig.get_subplot(1, 2).x) / 2, y=0.5, + font_size=20, showarrow=False, xanchor="center")]) fig.show() ``` From 803d44164b31644987eb1b35cebe5bb8e6df0948 Mon Sep 17 00:00:00 2001 From: Vyom Patel <40802839+patelvyom@users.noreply.github.com> Date: Mon, 17 Jul 2023 17:19:32 -0600 Subject: [PATCH 07/14] Update box-plots.md - There is no need for passing dummy variable `y` when stats have already been computed - `upperfence` values don't match the resulting figure. - It could be simplified even further by getting rid of the extra call to `add_trace` but I've kept it to follow the documentation styling. - It might be worth it to separate the example in two cases: (i) with only `q1`, `median`, `q3` provided, (ii) with all values provided. --- doc/python/box-plots.md | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/doc/python/box-plots.md b/doc/python/box-plots.md index a22762c0750..974774bb34e 100644 --- a/doc/python/box-plots.md +++ b/doc/python/box-plots.md @@ -233,16 +233,10 @@ import plotly.graph_objects as go fig = go.Figure() -fig.add_trace(go.Box(y=[ - [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ], - [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ], - [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ] - ], name="Precompiled Quartiles")) - -fig.update_traces(q1=[ 1, 2, 3 ], median=[ 4, 5, 6 ], +fig.add_trace(go.Box(q1=[ 1, 2, 3 ], median=[ 4, 5, 6 ], q3=[ 7, 8, 9 ], lowerfence=[-1, 0, 1], - upperfence=[5, 6, 7], mean=[ 2.2, 2.8, 3.2 ], - sd=[ 0.2, 0.4, 0.6 ], notchspan=[ 0.2, 0.4, 0.6 ] ) + upperfence=[7, 8, 9], mean=[ 2.2, 2.8, 3.2 ], + sd=[ 0.2, 0.4, 0.6 ], notchspan=[ 0.2, 0.4, 0.6 ], name="Precompiled Quartiles")) fig.show() ``` From f1e22f2217f78ec6812e141a2f66e0c511f66568 Mon Sep 17 00:00:00 2001 From: Liam Connors Date: Thu, 2 May 2024 14:32:52 -0400 Subject: [PATCH 08/14] update jupyterlab support section --- doc/python/getting-started.md | 36 +++++++++++------------------------ 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/doc/python/getting-started.md b/doc/python/getting-started.md index 3827de29c4f..076aec0ee9c 100644 --- a/doc/python/getting-started.md +++ b/doc/python/getting-started.md @@ -6,9 +6,9 @@ jupyter: extension: .md format_name: markdown format_version: '1.3' - jupytext_version: 1.14.1 + jupytext_version: 1.16.1 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.10.14 plotly: description: Getting Started with Plotly for Python. has_thumbnail: false @@ -96,8 +96,7 @@ IFrame(snippet_url + 'getting-started', width='100%', height=1200) #### JupyterLab Support -For use in [JupyterLab](https://jupyterlab.readthedocs.io/en/stable/), install the `jupyterlab` and `ipywidgets` -packages using `pip`: +To use `plotly` in [JupyterLab](https://jupyterlab.readthedocs.io/en/stable/), install the `jupyterlab` and `ipywidgets` packages in the same environment as you installed `plotly`, using `pip`: ``` $ pip install "jupyterlab>=3" "ipywidgets>=7.6" @@ -109,21 +108,16 @@ or `conda`: $ conda install "jupyterlab>=3" "ipywidgets>=7.6" ``` -You'll need `jupyter-dash` to add widgets such as sliders, dropdowns, and buttons to Plotly charts in JupyterLab. +The `plotly` jupyterlab extension is included when you install `plotly` using `pip` or `conda`. When you run Jupyter Lab, ensure you are running it in the same environment that you installed `plotly` in so it has access to the `plotly` jupyterlab extension. -Install [`jupyter-dash`](https://github.com/plotly/jupyter-dash) using `pip`: +**JupyterLab 2 or earlier** does not support the prebuilt extensions installed using `pip` and `conda`. If you are using JupyterLab 2, run the following command to install the required JupyterLab extensions (note that this will require [`node`](https://nodejs.org/) to be installed): ``` -$ pip install jupyter-dash -``` - -or `conda`: - -``` -$ conda install -c conda-forge -c plotly jupyter-dash +# JupyterLab 2.x renderer support +jupyter labextension install jupyterlab-plotly@5.22.0 @jupyter-widgets/jupyterlab-manager ``` -These packages contain everything you need to run JupyterLab... +Launch JupyterLab with: ``` $ jupyter lab @@ -148,18 +142,10 @@ fig_widget = go.FigureWidget(fig) fig_widget ``` -The instructions above apply to JupyterLab 3.x. **For JupyterLab 2 or earlier**, run the following commands to install the required JupyterLab extensions (note that this will require [`node`](https://nodejs.org/) to be installed): - -``` -# JupyterLab 2.x renderer support -jupyter labextension install jupyterlab-plotly@5.22.0 @jupyter-widgets/jupyterlab-manager -``` - -Please check out our [Troubleshooting guide](/python/troubleshooting/) if you run into any problems with JupyterLab, particularly if you are using multiple python environments inside Jupyter. - - See [_Displaying Figures in Python_](/python/renderers/) for more information on the renderers framework, and see [_Plotly FigureWidget Overview_](/python/figurewidget/) for more information on using `FigureWidget`. +See the [Troubleshooting guide](/python/troubleshooting/) if you run into any problems with JupyterLab, particularly if you are using multiple Python environments inside Jupyter. + #### Jupyter Notebook Support From 5a157d8824b1186e3d648395e5e5e42d2aa1df03 Mon Sep 17 00:00:00 2001 From: JulianWgs <31596773+JulianWgs@users.noreply.github.com> Date: Wed, 26 Jun 2024 09:46:13 +0200 Subject: [PATCH 09/14] Add v1hovermode to the list of all the modebar options fixes #3274 The list often serves as reference to look for modebar options and v1hovermode was missing. --- doc/python/configuration-options.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/python/configuration-options.md b/doc/python/configuration-options.md index 52dcc8764ec..4e9aa7f47e3 100644 --- a/doc/python/configuration-options.md +++ b/doc/python/configuration-options.md @@ -207,7 +207,7 @@ fig.show(config=config) To delete buttons from the modebar, pass an array of strings containing the names of the buttons you want to remove to the `modeBarButtonsToRemove` attribute in the figure's configuration dictionary. Note that different chart types have different default modebars. The following is a list of all the modebar buttons and the chart types they are associated with: - **High-level**: `zoom`, `pan`, `select`, `zoomIn`, `zoomOut`, `autoScale`, `resetScale` - - **2D**: `zoom2d`, `pan2d`, `select2d`, `lasso2d`, `zoomIn2d`, `zoomOut2d`, `autoScale2d`, `resetScale2d` + - **2D**: `zoom2d`, `pan2d`, `select2d`, `lasso2d`, `zoomIn2d`, `zoomOut2d`, `autoScale2d`, `resetScale2d`, `v1hovermode` - **2D Shape Drawing**: `drawline`, `drawopenpath`, `drawclosedpath`, `drawcircle`, `drawrect`, `eraseshape` - **3D**: `zoom3d`, `pan3d`, `orbitRotation`, `tableRotation`, `handleDrag3d`, `resetCameraDefault3d`, `resetCameraLastSave3d`, `hoverClosest3d` - **Cartesian**: `hoverClosestCartesian`, `hoverCompareCartesian` From 2f39de826e3a6c08e87affe73c5c39363960b0ba Mon Sep 17 00:00:00 2001 From: Rob L Date: Sat, 5 Oct 2024 15:54:44 -0400 Subject: [PATCH 10/14] fixing a bug that causes the hovertext to show %{text} rather than the continent There is a bug here that causes the hovertext to show one line as %{text} rather than showing the continent name. I have fixed it the way the comments imply that the example intended. either we should add a text parameter as I've done here, or the example could remove the %{text} from the hovertext and from the comments. --- doc/python/hover-text-and-formatting.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/python/hover-text-and-formatting.md b/doc/python/hover-text-and-formatting.md index 3dc4249e158..7a1fe873117 100644 --- a/doc/python/hover-text-and-formatting.md +++ b/doc/python/hover-text-and-formatting.md @@ -401,6 +401,7 @@ for continent_name, df in continent_data.items(): x=df['gdpPercap'], y=df['lifeExp'], marker_size=df['size'], + text=df['continent'], name=continent_name, # The next three parameters specify the hover text From ddb0f78ffca1f116142f4ed78fd211e4cdfbb6db Mon Sep 17 00:00:00 2001 From: Liam Connors Date: Thu, 10 Oct 2024 15:10:42 -0400 Subject: [PATCH 11/14] remove deprecated attributes --- doc/python/3d-bubble-charts.md | 74 ++++++++++++++++++---- doc/python/bar-charts.md | 20 +++--- doc/python/carpet-contour.md | 5 +- doc/python/colorscales.md | 12 ++-- doc/python/contour-plots.md | 15 +++-- doc/python/multiple-axes.md | 32 ++++++---- doc/python/network-graphs.md | 14 ++-- doc/python/range-slider.md | 36 ++++++++--- doc/python/scatter-plots-on-maps.md | 4 +- doc/python/setting-graph-size.md | 24 +++++-- doc/python/ternary-plots.md | 3 +- doc/unconverted/python/cars-exploration.md | 8 +-- 12 files changed, 178 insertions(+), 69 deletions(-) diff --git a/doc/python/3d-bubble-charts.md b/doc/python/3d-bubble-charts.md index 0877a6b55e4..3020f27d21c 100644 --- a/doc/python/3d-bubble-charts.md +++ b/doc/python/3d-bubble-charts.md @@ -113,12 +113,36 @@ fig = go.Figure(data=go.Scatter3d( ) )) -fig.update_layout(width=800, height=800, title = 'Planets!', - scene = dict(xaxis=dict(title='Distance from Sun', titlefont_color='white'), - yaxis=dict(title='Density', titlefont_color='white'), - zaxis=dict(title='Gravity', titlefont_color='white'), - bgcolor = 'rgb(20, 24, 54)' - )) +fig.update_layout( + width=800, + height=800, + title="Planets!", + scene=dict( + xaxis=dict( + title=dict( + text="Distance from Sun", + font=dict( + color="white" + ) + ), + yaxis=dict( + title=dict( + text="Density", + font=dict( + color="white" + ) + ), + zaxis=dict( + title=dict( + text="Gravity", + font=dict( + color="white" + ) + ), + bgcolor="rgb(20, 24, 54)", + ), +) + fig.show() ``` @@ -154,12 +178,38 @@ fig = go.Figure(go.Scatter3d( ) )) -fig.update_layout(width=800, height=800, title = 'Planets!', - scene = dict(xaxis=dict(title='Distance from Sun', titlefont_color='white'), - yaxis=dict(title='Density', titlefont_color='white'), - zaxis=dict(title='Gravity', titlefont_color='white'), - bgcolor = 'rgb(20, 24, 54)' - )) +fig.update_layout( + width=800, + height=800, + title="Planets!", + scene=dict( + xaxis=dict( + title=dict( + text="Distance from Sun", + font=dict( + color="white" + ) + ) + ), + yaxis=dict( + title=dict( + text="Density", + font=dict( + color="white" + ) + ) + ), + zaxis=dict( + title=dict( + text="Gravity", + font=dict( + color="white" + ) + ) + ), + bgcolor="rgb(20, 24, 54)" + ) +) fig.show() ``` diff --git a/doc/python/bar-charts.md b/doc/python/bar-charts.md index 7134ab2c68f..e93439cf1f9 100644 --- a/doc/python/bar-charts.md +++ b/doc/python/bar-charts.md @@ -37,7 +37,7 @@ jupyter: [Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on a variety of types of data](/python/px-arguments/) and produces [easy-to-style figures](/python/styling-plotly-express/). -With `px.bar`, **each row of the DataFrame is represented as a rectangular mark**. To aggregate multiple data points into the same rectangular mark, please refer to the [histogram documentation](/python/histograms). +With `px.bar`, **each row of the DataFrame is represented as a rectangular mark**. To aggregate multiple data points into the same rectangular mark, please refer to the [histogram documentation](/python/histograms). In the example below, there is only a single row of data per year, so a single bar is displayed per year. @@ -152,7 +152,7 @@ fig.show() ### Aggregating into Single Colored Bars -As noted above `px.bar()` will result in **one rectangle drawn per row of input**. This can sometimes result in a striped look as in the examples above. To combine these rectangles into one per color per position, you can use `px.histogram()`, which has [its own detailed documentation page](/python/histogram). +As noted above `px.bar()` will result in **one rectangle drawn per row of input**. This can sometimes result in a striped look as in the examples above. To combine these rectangles into one per color per position, you can use `px.histogram()`, which has [its own detailed documentation page](/python/histogram). > `px.bar` and `px.histogram` are designed to be nearly interchangeable in their call signatures, so as to be able to switch between aggregated and disaggregated bar representations. @@ -304,7 +304,7 @@ fig.update_layout(barmode='stack') fig.show() ``` -### Stacked Bar Chart From Aggregating a DataFrame +### Stacked Bar Chart From Aggregating a DataFrame Stacked bar charts are a powerful way to present results summarizing categories generated using the Pandas aggregate commands. `pandas.DataFrame.agg` produces a wide data set format incompatible with `px.bar`. Transposing and updating the indexes to achieve `px.bar` compatibility is a somewhat involved option. Here is one straightforward alternative, which presents the aggregated data as a stacked bar using plotly.graph_objects. @@ -326,19 +326,19 @@ df_summarized["percent of world population"]=100*df_summarized["pop"]/df_summari df_summarized["percent of world GDP"]=100*df_summarized["gdp"]/df_summarized["gdp"].sum() -df = df_summarized[["continent", +df = df_summarized[["continent", "percent of world population", "percent of world GDP", ]] # We now have a wide data frame, but it's in the opposite orientation from the one that px is designed to deal with. -# Transposing it and rebuilding the indexes is an option, but iterating through the DF using graph objects is more succinct. +# Transposing it and rebuilding the indexes is an option, but iterating through the DF using graph objects is more succinct. fig=go.Figure() for category in df_summarized["continent"].values: fig.add_trace(go.Bar( x=df.columns[1:], - # We need to get a pandas series that contains just the values to graph; + # We need to get a pandas series that contains just the values to graph; # We do so by selecting the right row, selecting the right columns # and then transposing and using iloc to convert to a series # Here, we assume that the bar element category variable is in column 0 @@ -619,8 +619,12 @@ fig.update_layout( title='US Export of Plastic Scrap', xaxis_tickfont_size=14, yaxis=dict( - title='USD (millions)', - titlefont_size=16, + title=dict( + text="USD (millions)", + font=dict( + size=16 + ) + ), tickfont_size=14, ), legend=dict( diff --git a/doc/python/carpet-contour.md b/doc/python/carpet-contour.md index 0d11800ea18..87642243977 100644 --- a/doc/python/carpet-contour.md +++ b/doc/python/carpet-contour.md @@ -159,9 +159,10 @@ fig.add_trace(go.Contourcarpet( colorbar = dict( y = 0, yanchor = "bottom", - titleside = "right", len = 0.75, - title = "Pressure coefficient, cp" + title = dict( + text="Pressure coefficient, cp", + side="right") ), contours = dict( start = -1, diff --git a/doc/python/colorscales.md b/doc/python/colorscales.md index 7e2aeb9ad73..757ff54911e 100644 --- a/doc/python/colorscales.md +++ b/doc/python/colorscales.md @@ -321,8 +321,10 @@ fig = go.Figure() fig.add_trace(go.Heatmap( z=dataset["z"], colorbar=dict( - title="Surface Heat", - titleside="top", + title=dict( + text="Surface Heat", + side="top", + ), tickmode="array", tickvals=[2, 25, 50, 75, 100], labelalias={100: "Hot", 50: "Mild", 2: "Cold"}, @@ -545,8 +547,10 @@ fig = go.Figure() fig.add_trace(go.Heatmap( z=dataset["z"], colorbar=dict( - title="Surface Heat", - titleside="top", + title=dict( + text="Surface Heat", + side="top", + ), tickmode="array", tickvals=[2, 50, 100], ticktext=["Cool", "Mild", "Hot"], diff --git a/doc/python/contour-plots.md b/doc/python/contour-plots.md index feb4f3b68a2..4ba74b175d4 100644 --- a/doc/python/contour-plots.md +++ b/doc/python/contour-plots.md @@ -281,12 +281,15 @@ fig = go.Figure(data= [0.625, 1.25, 3.125, 6.25, 10.625], [0, 0.625, 2.5, 5.625, 10]], colorbar=dict( - title='Color bar title', # title here - titleside='right', - titlefont=dict( - size=14, - family='Arial, sans-serif') - ))) + title=dict( + text='Color bar title', # title here + side='right', + font=dict( + size=14, + family='Arial, sans-serif') + ) + ), + )) fig.show() ``` diff --git a/doc/python/multiple-axes.md b/doc/python/multiple-axes.md index 5bbdeda3c93..5a8deae7e53 100644 --- a/doc/python/multiple-axes.md +++ b/doc/python/multiple-axes.md @@ -192,18 +192,22 @@ fig.update_layout( domain=[0.3, 0.7] ), yaxis=dict( - title="yaxis title", - titlefont=dict( - color="#1f77b4" + title=dict( + text="yaxis title", + font=dict( + color="#1f77b4" + ) ), tickfont=dict( color="#1f77b4" ) ), yaxis2=dict( - title="yaxis2 title", - titlefont=dict( - color="#ff7f0e" + title=dict( + text="yaxis2 title", + font=dict( + color="#ff7f0e" + ) ), tickfont=dict( color="#ff7f0e" @@ -214,9 +218,11 @@ fig.update_layout( position=0.15 ), yaxis3=dict( - title="yaxis3 title", - titlefont=dict( - color="#d62728" + title=dict( + text="yaxis3 title", + font=dict( + color="#d62728" + ) ), tickfont=dict( color="#d62728" @@ -226,9 +232,11 @@ fig.update_layout( side="right" ), yaxis4=dict( - title="yaxis4 title", - titlefont=dict( - color="#9467bd" + title=dict( + text="yaxis4 title", + font=dict( + color="#9467bd" + ) ), tickfont=dict( color="#9467bd" diff --git a/doc/python/network-graphs.md b/doc/python/network-graphs.md index 9d2f3fec2e2..ae47e9923c0 100644 --- a/doc/python/network-graphs.md +++ b/doc/python/network-graphs.md @@ -98,9 +98,11 @@ node_trace = go.Scatter( size=10, colorbar=dict( thickness=15, - title='Node Connections', + title=dict( + text='Node Connections', + side='right' + ), xanchor='left', - titleside='right' ), line_width=2)) @@ -128,8 +130,12 @@ node_trace.text = node_text ```python fig = go.Figure(data=[edge_trace, node_trace], layout=go.Layout( - title='
Network graph made with Python', - titlefont_size=16, + title=dict( + text="
Network graph made with Python", + font=dict( + size=16 + ) + ), showlegend=False, hovermode='closest', margin=dict(b=20,l=5,r=5,t=40), diff --git a/doc/python/range-slider.md b/doc/python/range-slider.md index 9d1bce3bde6..bd6744fe7ac 100644 --- a/doc/python/range-slider.md +++ b/doc/python/range-slider.md @@ -252,7 +252,11 @@ fig.update_layout( tickfont={"color": "#673ab7"}, tickmode="auto", ticks="", - titlefont={"color": "#673ab7"}, + title=dict( + font=dict( + color="#673ab7" + ) + ), type="linear", zeroline=False ), @@ -268,7 +272,11 @@ fig.update_layout( tickfont={"color": "#E91E63"}, tickmode="auto", ticks="", - titlefont={"color": "#E91E63"}, + title=dict( + font=dict( + color="#E91E63" + ) + ), type="linear", zeroline=False ), @@ -284,8 +292,12 @@ fig.update_layout( tickfont={"color": "#795548"}, tickmode="auto", ticks="", - title="mg/L", - titlefont={"color": "#795548"}, + title=dict( + text="mg/L", + font=dict( + color="#795548" + ) + ), type="linear", zeroline=False ), @@ -301,8 +313,12 @@ fig.update_layout( tickfont={"color": "#607d8b"}, tickmode="auto", ticks="", - title="mmol/L", - titlefont={"color": "#607d8b"}, + title=dict( + text="mmol/L", + font=dict( + color="#607d8b" + ) + ), type="linear", zeroline=False ), @@ -318,8 +334,12 @@ fig.update_layout( tickfont={"color": "#2196F3"}, tickmode="auto", ticks="", - title="mg/Kg", - titlefont={"color": "#2196F3"}, + title=dict( + text="mg/Kg", + font=dict( + color="#2196F3" + ) + ), type="linear", zeroline=False ) diff --git a/doc/python/scatter-plots-on-maps.md b/doc/python/scatter-plots-on-maps.md index 9c4ad70bea8..e22a019eb6e 100644 --- a/doc/python/scatter-plots-on-maps.md +++ b/doc/python/scatter-plots-on-maps.md @@ -187,7 +187,9 @@ fig = go.Figure(data=go.Scattergeo( opacity = 0.7, size = 2, colorbar = dict( - titleside = "right", + title = dict( + side="right" + ), outlinecolor = "rgba(68, 68, 68, 0)", ticks = "outside", showticksuffix = "last", diff --git a/doc/python/setting-graph-size.md b/doc/python/setting-graph-size.md index 611e0e29825..717c25341df 100644 --- a/doc/python/setting-graph-size.md +++ b/doc/python/setting-graph-size.md @@ -118,11 +118,15 @@ fig.update_layout( width=500, height=500, yaxis=dict( - title_text="Y-axis Title", + title=dict( + text="Y-axis Title", + font=dict( + size=30 + ) + ), ticktext=["Very long label", "long label", "3", "label"], tickvals=[1, 2, 3, 4], tickmode="array", - titlefont=dict(size=30), ) ) @@ -153,11 +157,15 @@ fig.update_layout( width=500, height=500, yaxis=dict( - title_text="Y-axis Title", + title=dict( + text="Y-axis Title", + font=dict( + size=30 + ) + ), ticktext=["Very long label", "long label", "3", "label"], tickvals=[1, 2, 3, 4], tickmode="array", - titlefont=dict(size=30), ) ) @@ -190,11 +198,15 @@ fig.update_layout( width=450, height=450, yaxis=dict( - title_text="Y-axis Title", + title=dict( + text="Y-axis Title", + font=dict( + size=30 + ) + ), ticktext=["Label", "Very long label", "Other label", "Very very long label"], tickvals=[1, 2, 3, 4], tickmode="array", - titlefont=dict(size=30), ) ) diff --git a/doc/python/ternary-plots.md b/doc/python/ternary-plots.md index a389faba417..84e3de7cf67 100644 --- a/doc/python/ternary-plots.md +++ b/doc/python/ternary-plots.md @@ -82,8 +82,7 @@ rawData = [ def makeAxis(title, tickangle): return { - 'title': title, - 'titlefont': { 'size': 20 }, + 'title': {'text': title, 'font': { 'size': 20}, 'tickangle': tickangle, 'tickfont': { 'size': 15 }, 'tickcolor': 'rgba(0,0,0,0)', diff --git a/doc/unconverted/python/cars-exploration.md b/doc/unconverted/python/cars-exploration.md index 34bb4aad123..70344867e54 100644 --- a/doc/unconverted/python/cars-exploration.md +++ b/doc/unconverted/python/cars-exploration.md @@ -109,19 +109,19 @@ fig.layout.title = 'Torque and Fuel Efficience' Check default font size ```python -fig.layout.titlefont.size +fig.layout.title.font.size ``` Increase the title font size ```python -fig.layout.titlefont.size = 22 +fig.layout.title.font.size = 22 ``` -Set `fig.layout.titlefont.family` to `'Rockwell'` +Set `fig.layout.title.font.family` to `'Rockwell'` ```python -fig.layout.titlefont.family = 'Rockwell' +fig.layout.title.font.family = 'Rockwell' ``` ### Create New View for Figure From 0094d5ad7c6e8ee127ca7bf4a8755997c245811c Mon Sep 17 00:00:00 2001 From: Liam Connors Date: Thu, 10 Oct 2024 15:27:02 -0400 Subject: [PATCH 12/14] fix syntax error --- doc/python/3d-bubble-charts.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/doc/python/3d-bubble-charts.md b/doc/python/3d-bubble-charts.md index 3020f27d21c..f4ab9dc44ab 100644 --- a/doc/python/3d-bubble-charts.md +++ b/doc/python/3d-bubble-charts.md @@ -5,10 +5,10 @@ jupyter: text_representation: extension: .md format_name: markdown - format_version: '1.1' - jupytext_version: 1.2.3 + 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.7.3 + version: 3.11.10 plotly: description: How to make 3D Bubble Charts in Python with Plotly. Three examples of 3D Bubble Charts. @@ -124,6 +124,7 @@ fig.update_layout( font=dict( color="white" ) + ) ), yaxis=dict( title=dict( @@ -216,4 +217,4 @@ fig.show() #### Reference -See https://plotly.com/python/reference/scatter3d/ and https://plotly.com/python/reference/scatter/#scatter-marker-sizeref
for more information and chart attribute options! \ No newline at end of file +See https://plotly.com/python/reference/scatter3d/ and https://plotly.com/python/reference/scatter/#scatter-marker-sizeref
for more information and chart attribute options! From 482e8f8923a1925f7942245291ea99dd2b5049b8 Mon Sep 17 00:00:00 2001 From: Liam Connors Date: Thu, 10 Oct 2024 15:28:25 -0400 Subject: [PATCH 13/14] fix syntax error --- doc/python/ternary-plots.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/python/ternary-plots.md b/doc/python/ternary-plots.md index 84e3de7cf67..f53a0862b08 100644 --- a/doc/python/ternary-plots.md +++ b/doc/python/ternary-plots.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 Ternary plots in Python with Plotly. display_as: scientific @@ -82,7 +82,7 @@ rawData = [ def makeAxis(title, tickangle): return { - 'title': {'text': title, 'font': { 'size': 20}, + 'title': {'text': title, 'font': { 'size': 20}}, 'tickangle': tickangle, 'tickfont': { 'size': 15 }, 'tickcolor': 'rgba(0,0,0,0)', From 827d9dc2680f4382d8f1b4fe0f58c69e1f63e79b Mon Sep 17 00:00:00 2001 From: Liam Connors Date: Thu, 10 Oct 2024 15:52:38 -0400 Subject: [PATCH 14/14] fix example --- doc/python/3d-bubble-charts.md | 36 ++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/doc/python/3d-bubble-charts.md b/doc/python/3d-bubble-charts.md index f4ab9dc44ab..8abaf0fbdcc 100644 --- a/doc/python/3d-bubble-charts.md +++ b/doc/python/3d-bubble-charts.md @@ -119,29 +119,31 @@ fig.update_layout( title="Planets!", scene=dict( xaxis=dict( - title=dict( - text="Distance from Sun", - font=dict( - color="white" - ) - ) + title=dict( + text="Distance from Sun", + font=dict( + color="white" + ) + ) ), yaxis=dict( - title=dict( - text="Density", - font=dict( - color="white" + title=dict( + text="Density", + font=dict( + color="white" + ) ) ), zaxis=dict( - title=dict( - text="Gravity", - font=dict( - color="white" + title=dict( + text="Gravity", + font=dict( + color="white" + ) ) - ), - bgcolor="rgb(20, 24, 54)", - ), + ), + bgcolor="rgb(20, 24, 54)" + ) )