diff --git a/doc/python/dumbbell-plots.md b/doc/python/dumbbell-plots.md index b41bb46048f..224187c6596 100644 --- a/doc/python/dumbbell-plots.md +++ b/doc/python/dumbbell-plots.md @@ -94,7 +94,6 @@ fig = go.Figure( fig.update_layout( title="Life Expectancy in Europe: 1952 and 2002", - width=1000, height=1000, showlegend=False, ) @@ -109,7 +108,7 @@ fig.show() In this example, we add arrow markers to the plot. The first trace adds the lines connecting the data points and arrow markers. The second trace adds circle markers. On the first trace, we use `standoff=8` to position the arrow marker back from the data point. -For the arrow marker to point directly at the circle marker, this value should be half the circle marker size. +For the arrow marker to point directly at the circle marker, this value should be half the circle marker size, which is hardcoded to 16 here. ```python import pandas as pd @@ -165,7 +164,6 @@ fig = go.Figure( fig.update_layout( title="Life Expectancy in Europe: 1952 and 2002", - width=1000, height=1000, showlegend=False, ) diff --git a/doc/python/ml-pca.md b/doc/python/ml-pca.md index b231259aa6c..cbd38e0fd9c 100644 --- a/doc/python/ml-pca.md +++ b/doc/python/ml-pca.md @@ -250,11 +250,16 @@ loadings = pca.components_.T * np.sqrt(pca.explained_variance_) fig = px.scatter(components, x=0, y=1, color=df['species']) for i, feature in enumerate(features): - fig.add_shape( - type='line', - x0=0, y0=0, - x1=loadings[i, 0], - y1=loadings[i, 1] + fig.add_annotation( + ax=0, ay=0, + axref="x", ayref="y", + x=loadings[i, 0], + y=loadings[i, 1], + showarrow=True, + arrowsize=2, + arrowhead=2, + xanchor="right", + yanchor="top" ) fig.add_annotation( x=loadings[i, 0], @@ -263,6 +268,7 @@ for i, feature in enumerate(features): xanchor="center", yanchor="bottom", text=feature, + yshift=5, ) fig.show() ```