# Adding text overrides the symbol I want to use - px.scatter

**URL:** <https://community.plotly.com/t/adding-text-overrides-the-symbol-i-want-to-use-px-scatter/69351>\
**Category:** 📊 Plotly Python\
**Created:** [October 28, 2022, 6:08pm UTC](https://community.plotly.com/t/adding-text-overrides-the-symbol-i-want-to-use-px-scatter/69351 "2022-10-28T18:08:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![moisternw](https://avatars.discourse-cdn.com/v4/letter/m/e0b2c6/32.png) [@moisternw](https://community.plotly.com/u/moisternw)\
**Post date:** [October 28, 2022, 6:08pm UTC](https://community.plotly.com/t/adding-text-overrides-the-symbol-i-want-to-use-px-scatter/69351/1 "2022-10-28T18:08:17Z")

</div>

Hello, I’m using `px.scatter` to create a scatter plot, and I want the symbols to be squares. I’d also like to show the text for each point.

Currently, I’m using

```auto
fig.update_traces(
    marker=dict(symbol="square",
                line=dict(width=2, color="DarkSlateGrey") ),
    selector=dict(mode="markers"),
)

```

to generate this chart:

 ![Screen Shot 2022-10-28 at 10.55.14 AM](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/e/7/e7455bc3211261e5455aed68ac282583594fa88e.png)

I’d like to add text next to each square, and I have a corresponding columns in my dataframe that I’d like to use. However, when I enable the `text` parameter in `px.scatter`, the chart doesn’t show squares anymore, and overrides to circles.

I.e. if I do:

```auto
fig = px.scatter(heatmap_data, 
                 x="...", 
                 y="...", 
                 size="...",
                 color = "...",
                 text = 'something',
                 color_continuous_scale= "...",
                 width=1100,
                 height=750,
                 title= "..."

```

The squares above become circles.

**How can I avoid this, and add text without losing the squares?**

---

<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:** [October 28, 2022, 7:54pm UTC](https://community.plotly.com/t/adding-text-overrides-the-symbol-i-want-to-use-px-scatter/69351/2 "2022-10-28T19:54:05Z")

</div>

> [@moisternw](#):
>
> ` selector=dict(mode="markers"),`

Try changing this to

`selector=dict(mode="markers+text")`

Example code:

```python
import plotly.express as px
import numpy as np

x = np.random.randint(10, 50, 10)
y = np.random.randint(10, 50, 10)
text = np.random.randint(1, 3, 10)

fig = px.scatter(
    x=x,
    y=y,
    text=text
)

fig.update_traces(
    marker=dict(
        symbol="square",
        color='red',
        size=20,
        line=dict(width=2, color="DarkSlateGrey") ),
        selector=dict(mode="markers+text"),
)

```

Creates:

 ![newplot(9)](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/b/9/b9c48421df8edbea21c797596ee11d84565b1e9c.png)

EDIT: you might even delete the `selector` parameter if you do wanted to change all traces in your figure.

---

<div class="post-metadata">

**Author:** ![moisternw](https://avatars.discourse-cdn.com/v4/letter/m/e0b2c6/32.png) [@moisternw](https://community.plotly.com/u/moisternw)\
**Post date:** [October 28, 2022, 8:44pm UTC](https://community.plotly.com/t/adding-text-overrides-the-symbol-i-want-to-use-px-scatter/69351/3 "2022-10-28T20:44:33Z")

</div>

Thank you!
