我想创建一个只有一条趋势线的散点图。绘图表示会为点列表中的每种颜色创建不同的趋势线。
import plotly.express as px
value = [15, 20, 35, 40, 48]
years = [2010, 2011, 2012, 2013, 2014]
colors = ['red', 'red', 'blue', 'blue', 'blue']
fig = px.scatter(
x=years,
y=value,
trendline='ols',
color=colors
)
fig.show()
有没有办法为所有点创建一条趋势线?
情节:
提前致谢!
我来说两句