diff --git a/doc/python/3d-bubble-charts.md b/doc/python/3d-bubble-charts.md index 403e3dc2031..f4b57248d8b 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. @@ -113,12 +113,38 @@ fig = go.Figure(data=go.Scatter3d( ) )) -fig.update_layout(width=800, height=800, title = 'Planets!', - scene = dict(xaxis=dict(title='Distance from Sun', title_font_color='white'), - yaxis=dict(title='Density', title_font_color='white'), - zaxis=dict(title='Gravity', title_font_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,16 +180,42 @@ fig = go.Figure(go.Scatter3d( ) )) -fig.update_layout(width=800, height=800, title = 'Planets!', - scene = dict(xaxis=dict(title='Distance from Sun', title_font_color='white'), - yaxis=dict(title='Density', title_font_color='white'), - zaxis=dict(title='Gravity', title_font_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() ``` #### 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! diff --git a/doc/python/animations.md b/doc/python/animations.md index c765d36621f..045111c90e7 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() ``` diff --git a/doc/python/bar-charts.md b/doc/python/bar-charts.md index 431a0ce3583..674f3659c80 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,9 +619,12 @@ fig.update_layout( title='US Export of Plastic Scrap', xaxis_tickfont_size=14, yaxis=dict( - title='USD (millions)', - title_font_size=16, - tickfont_size=14, + title=dict( + text="USD (millions)", + font=dict( + size=16 + ) + ), ), legend=dict( x=0, diff --git a/doc/python/box-plots.md b/doc/python/box-plots.md index dbaca729096..5ca79d51b0f 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() ``` 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/configuration-options.md b/doc/python/configuration-options.md index 1b884b84786..a7ffd46fed8 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` diff --git a/doc/python/contour-plots.md b/doc/python/contour-plots.md index ec811c5253b..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', - title_font=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/custom-buttons.md b/doc/python/custom-buttons.md index 014dc8ad2e4..10f3ab07e2a 100644 --- a/doc/python/custom-buttons.md +++ b/doc/python/custom-buttons.md @@ -369,47 +369,55 @@ 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="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)] diff --git a/doc/python/getting-started.md b/doc/python/getting-started.md index 5f9d2dab19b..5d9094629ab 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. - -Install [`jupyter-dash`](https://github.com/plotly/jupyter-dash) using `pip`: - -``` -$ pip install jupyter-dash -``` +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. -or `conda`: +**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): ``` -$ 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.24.1 @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 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 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 ) diff --git a/doc/python/multiple-axes.md b/doc/python/multiple-axes.md index 3abbd5797f2..0eaefb4829a 100644 --- a/doc/python/multiple-axes.md +++ b/doc/python/multiple-axes.md @@ -192,21 +192,19 @@ fig.update_layout( domain=[0.3, 0.7] ), yaxis=dict( - title="yaxis title", - title_font=dict( - color="#1f77b4" + title=dict( + text="yaxis title", + font=dict( + color="#1f77b4" + ) ), - tickfont=dict( - color="#1f77b4" - ) ), yaxis2=dict( - title="yaxis2 title", - title_font=dict( - color="#ff7f0e" - ), - tickfont=dict( - color="#ff7f0e" + title=dict( + text="yaxis2 title", + font=dict( + color="#ff7f0e" + ) ), anchor="free", overlaying="y", @@ -214,24 +212,22 @@ fig.update_layout( position=0.15 ), yaxis3=dict( - title="yaxis3 title", - title_font=dict( - color="#d62728" - ), - tickfont=dict( - color="#d62728" + title=dict( + text="yaxis3 title", + font=dict( + color="#d62728" + ) ), anchor="x", overlaying="y", side="right" ), yaxis4=dict( - title="yaxis4 title", - title_font=dict( - color="#9467bd" - ), - tickfont=dict( - color="#9467bd" + title=dict( + text="yaxis4 title", + font=dict( + color="#9467bd" + ) ), anchor="free", overlaying="y", diff --git a/doc/python/network-graphs.md b/doc/python/network-graphs.md index f8037e1c42a..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', - title_font_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/pie-charts.md b/doc/python/pie-charts.md index dc44c094b1f..c03e37aba68 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() ``` diff --git a/doc/python/range-slider.md b/doc/python/range-slider.md index dcbdce385ea..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="", - title_font={"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="", - title_font={"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", - title_font={"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", - title_font={"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", - title_font={"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 3eacdc259b7..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", - title_font=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", - title_font=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", - title_font=dict(size=30), ) ) diff --git a/doc/python/shapes.md b/doc/python/shapes.md index 5d67fbf598c..23bb514ea46 100644 --- a/doc/python/shapes.md +++ b/doc/python/shapes.md @@ -569,7 +569,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", ), diff --git a/doc/python/ternary-plots.md b/doc/python/ternary-plots.md index 106ee6f54f8..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,8 +82,7 @@ rawData = [ def makeAxis(title, tickangle): return { - 'title': title, - 'title_font': { '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 7726394919e..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.title_font.size +fig.layout.title.font.size ``` Increase the title font size ```python -fig.layout.title_font.size = 22 +fig.layout.title.font.size = 22 ``` -Set `fig.layout.title_font.family` to `'Rockwell'` +Set `fig.layout.title.font.family` to `'Rockwell'` ```python -fig.layout.title_font.family = 'Rockwell' +fig.layout.title.font.family = 'Rockwell' ``` ### Create New View for Figure