# How to add points on the scatter line with plotly graph\_objects

**URL:** <https://community.plotly.com/t/how-to-add-points-on-the-scatter-line-with-plotly-graph-objects/74026>\
**Category:** 📊 Plotly Python\
**Created:** [March 31, 2023, 2:34pm UTC](https://community.plotly.com/t/how-to-add-points-on-the-scatter-line-with-plotly-graph-objects/74026 "2023-03-31T14:34:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sc0v1n0](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/sc0v1n0/32/23469_2.png) [@sc0v1n0](https://community.plotly.com/u/sc0v1n0)\
**Post date:** [March 31, 2023, 2:34pm UTC](https://community.plotly.com/t/how-to-add-points-on-the-scatter-line-with-plotly-graph-objects/74026/1 "2023-03-31T14:34:58Z")

</div>

I’m using plotly graph\_objects for the Figure Class. I’m creating a pareto chart, I have a question. I need to add points for each variable on the line. I looked at the documentation and I didn’t find something to approximate like px.line(markers=True)

This is my code that I’m using for data

```python
trace2 = {
  "line": {
    "color": "rgb(255,7,7)", 
    "width": 2.5,
    #'backoff':True
  }, 
  "name": "Pareto graph", 
  "type": "scatter",
  "x": dataframe.index, 
  "y": dataframe['random'], 
  "yaxis": "y2",
}

```

This current graphic I put some circles to show the idea that I want to get a result

 ![image](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/5/a/5a79d2874b392c094e4d0ed4773192d3502dd914.png)

---

<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:** [March 31, 2023, 2:45pm UTC](https://community.plotly.com/t/how-to-add-points-on-the-scatter-line-with-plotly-graph-objects/74026/2 "2023-03-31T14:45:02Z")

</div>

Hi @sc0v1n0 welcome to the forums.

I think you are searching for `mode='lines+markers'`

[https://plotly.com/python/line-and-scatter/](https://plotly.com/python/line-and-scatter/)

Extracted example:

```python
import plotly.graph_objects as go

# Create random data with numpy
import numpy as np
np.random.seed(1)

N = 100
random_x = np.linspace(0, 1, N)
random_y0 = np.random.randn(N) + 5
random_y1 = np.random.randn(N)
random_y2 = np.random.randn(N) - 5

fig = go.Figure()

# Add traces
fig.add_trace(go.Scatter(x=random_x, y=random_y0,
                    mode='markers',
                    name='markers'))
fig.add_trace(go.Scatter(x=random_x, y=random_y1,
                    mode='lines+markers',
                    name='lines+markers'))
fig.add_trace(go.Scatter(x=random_x, y=random_y2,
                    mode='lines',
                    name='lines'))

fig.show()

```

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

---

<div class="post-metadata">

**Author:** ![sc0v1n0](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/sc0v1n0/32/23469_2.png) [@sc0v1n0](https://community.plotly.com/u/sc0v1n0)\
**Post date:** [March 31, 2023, 4:42pm UTC](https://community.plotly.com/t/how-to-add-points-on-the-scatter-line-with-plotly-graph-objects/74026/3 "2023-03-31T16:42:23Z")

</div>

Thanks, It turned out better than I thought.

```python
bar_1 = Bar(
    x=dataframe.index, 
    y= dataframe['random'], 
    name="random",
    marker= {
      "color": list(np.repeat('rgb(38,76,208)', 10) )+ list(np.repeat('rgb(50,205,50)', len(dataframe.index) - 10)),
    }
)

scatter_1 = Scatter(
    x=dataframe.index, 
    y=dataframe['random'],
    line={
      "color": "rgb(255,7,7)", 
      "width": 2.5,
      'backoff':True,
    }, 
    yaxis= "y2",
    name= "Pareto", 
   mode='lines+markers'
)

```

 ![image](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/b/e/bee7d0a7176e46d3835fc6c406fa473394fccf0f.png)
