Skip to content

Commit f1ace1a

Browse files
facet annotations
1 parent ec972cc commit f1ace1a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

doc/python/facet-plots.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ import plotly.express as px
9393
df = px.data.stocks(indexed=True)
9494
fig = px.line(df, facet_col="company", facet_col_wrap=2)
9595
fig.add_hline(y=1, line_dash="dot",
96-
annotation_text="Jan 1, 2018 baseline",
96+
annotation_text="Jan 1, 2018 baseline",
9797
annotation_position="bottom right")
9898

9999
fig.add_vrect(x0="2018-09-24", x1="2018-12-18", col=1,
@@ -110,7 +110,7 @@ The `.add_trace()` method can be used to add a copy of the same trace to each fa
110110
```python
111111
import plotly.express as px
112112
df = px.data.tips()
113-
fig = px.scatter(df, x="total_bill", y="tip", color='sex',
113+
fig = px.scatter(df, x="total_bill", y="tip", color='sex',
114114
facet_col="day", facet_row="time")
115115

116116
import statsmodels.api as sm
@@ -119,7 +119,7 @@ df = df.sort_values(by="total_bill")
119119
model = sm.OLS(df["tip"], sm.add_constant(df["total_bill"])).fit()
120120

121121
#create the trace to be added to all facets
122-
trace = go.Scatter(x=df_sorted["total_bill"], y=model.predict(),
122+
trace = go.Scatter(x=df["total_bill"], y=model.predict(),
123123
line_color="black", name="overall OLS")
124124

125125
# give it a legend group and hide it from the legend

0 commit comments

Comments
 (0)