# Datetime-type \`x\` values are incorrectly plotted in \`px.scatter\`

**URL:** <https://community.plotly.com/t/datetime-type-x-values-are-incorrectly-plotted-in-px-scatter/82540>\
**Category:** 📊 Plotly Python\
**Created:** [February 23, 2024, 4:33pm UTC](https://community.plotly.com/t/datetime-type-x-values-are-incorrectly-plotted-in-px-scatter/82540 "2024-02-23T16:33:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![j-at-ch](https://avatars.discourse-cdn.com/v4/letter/j/ecae2f/32.png) [@j-at-ch](https://community.plotly.com/u/j-at-ch)\
**Post date:** [February 23, 2024, 4:33pm UTC](https://community.plotly.com/t/datetime-type-x-values-are-incorrectly-plotted-in-px-scatter/82540/1 "2024-02-23T16:33:25Z")

</div>

I’m trying to _plotly_ a series of values using `plotly.express.scatter`, but there seems to be a strange binning phenomenon occurring in the resulting figure.

The hover values are correctly placed, but the markers are incorrectly placed.  
When using `px.line` however, the plot is displayed correctly.

I’m currently using the latest version of plotly 5.19.0 (but the same issue was present for 5.9.0)

Can anybody explain what’s happening here?

MWE:

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

timestamps = pd.date_range('2020-01-01T09:00', '2020-01-01T10:00', freq='s')
values = np.random.rand(len(timestamps))

df = pd.DataFrame({'t': timestamps, 'x': values})

px.scatter(df, x="t", y="x")

```

Resulting figure:

 ![Screenshot 2024-02-23 at 16.34.19](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/7/a/7a9087a804fe386b514834565ea9c9e5b4cbde79.png)

---

<div class="post-metadata">

**Author:** ![j-at-ch](https://avatars.discourse-cdn.com/v4/letter/j/ecae2f/32.png) [@j-at-ch](https://community.plotly.com/u/j-at-ch)\
**Post date:** [February 23, 2024, 5:07pm UTC](https://community.plotly.com/t/datetime-type-x-values-are-incorrectly-plotted-in-px-scatter/82540/2 "2024-02-23T17:07:13Z")

</div>

Ok - rapid turn-around - the solution is to change the renderer to “svg”

```python
px.scatter(df, x="t", y="x", render_mode="svg")

```

For more details on this see the related discussion [here](https://community.plotly.com/t/plotly-express-scatter-with-date-as-xaxis/74210).
