# How to assign a trendline to only one trace, or assign different trendlines to different traces, in the same plot?

**URL:** <https://community.plotly.com/t/how-to-assign-a-trendline-to-only-one-trace-or-assign-different-trendlines-to-different-traces-in-the-same-plot/75755>\
**Category:** 📊 Plotly Python\
**Created:** [June 1, 2023, 2:04pm UTC](https://community.plotly.com/t/how-to-assign-a-trendline-to-only-one-trace-or-assign-different-trendlines-to-different-traces-in-the-same-plot/75755 "2023-06-01T14:04:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikkelc](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/mikkelc/32/14107_2.png) [@mikkelc](https://community.plotly.com/u/mikkelc)\
**Post date:** [June 1, 2023, 2:04pm UTC](https://community.plotly.com/t/how-to-assign-a-trendline-to-only-one-trace-or-assign-different-trendlines-to-different-traces-in-the-same-plot/75755/1 "2023-06-01T14:04:47Z")

</div>

Hi, I am plotting a simple scatter plot with two y-axis variables (individual traces). I would like to fit a "trendline=“ols” to only one of the traces. Is that possible?

> Blockquote  
> import pandas as pd  
> import plotly as plt  
> import plotly.express as px  
> import [plotly.io](http://plotly.io) as pio

data = pd.read\_csv(r"somedata.csv")  
plot = px.scatter(data, x=“Cx”, y=[“Tm”,“Tg”], trendline=“ols”)  
plot.show()

This gives a plot with two ols traces for each trace (“Tm” and “Tg”).

 ![newplot](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/0/4/0419553579f9520da8389cfa64744b845a972345.png)

Can I either remove one of the ols trendlines, or replace one of the ols trendlines with a trendline=“lowess” ?

---

<div class="post-metadata">

**Author:** ![AIMPED](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/aimped/32/21758_2.png) [@AIMPED](https://community.plotly.com/u/AIMPED)\
**Post date:** [June 1, 2023, 2:39pm UTC](https://community.plotly.com/t/how-to-assign-a-trendline-to-only-one-trace-or-assign-different-trendlines-to-different-traces-in-the-same-plot/75755/2 "2023-06-01T14:39:43Z")

</div>

HI @mikkelc welcome to the forums!

Take a look here concerning the trendlines searching on this page for `Displaying a single trendline with multiple traces`

> **[Linear](https://plotly.com/python/linear-fits/)**
>
> Over 15 examples of Linear and Non-Linear Trendlines including changing color, size, log axes, and more in Python.
