# Struggling with plotting weekly time series data

**URL:** <https://community.plotly.com/t/struggling-with-plotting-weekly-time-series-data/35234>\
**Category:** Dash Python\
**Created:** [February 20, 2020, 11:20am UTC](https://community.plotly.com/t/struggling-with-plotting-weekly-time-series-data/35234 "2020-02-20T11:20:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris369](https://avatars.discourse-cdn.com/v4/letter/c/82dd89/32.png) [@Chris369](https://community.plotly.com/u/Chris369)\
**Post date:** [February 20, 2020, 11:20am UTC](https://community.plotly.com/t/struggling-with-plotting-weekly-time-series-data/35234/1 "2020-02-20T11:20:10Z")

</div>

Hi

I am trying to plot weekly totals in Dash and I have my data summarised in a df by “Week Commencing” dates.

The figure I am generating is this:

```auto
{'data': [Scatter({
    'mode': 'lines',
    'name': 'Trace1',
    'x': array([datetime.date(2019, 12, 30), datetime.date(2020, 1, 6),
                datetime.date(2020, 1, 13), datetime.date(2020, 1, 20),
                datetime.date(2020, 1, 27), datetime.date(2020, 2, 3),
                datetime.date(2020, 2, 10)], dtype=object),
    'y': array([[790],
                [1115],
                [1159],
                [883],
                [1018],
                [1166],
                [804]]),
    'yaxis': 'y'
}), Scatter({
    'mode': 'lines',
    'name': 'Trace2',
    'x': array([datetime.date(2019, 12, 30), datetime.date(2020, 1, 6),
                datetime.date(2020, 1, 13), datetime.date(2020, 1, 20),
                datetime.date(2020, 1, 27), datetime.date(2020, 2, 3),
                datetime.date(2020, 2, 10)], dtype=object),
    'y': array([[0],
                [0],
                [0],
                [0],
                [0],
                [716],
                [890]]),
    'yaxis': 'y'
})], 'layout': Layout({
    'autosize': False,
    'legend': {'orientation': 'h'},
    'margin': {'b': 30, 'l': 20, 'r': 0, 't': 20},
    'showlegend': True,
    'xaxis': {'autorange': True, 'showline': True, 'type': 'date'},
    'yaxis': {'autorange': True, 'showgrid': True, 'showline': True, 'zeroline': False}
})}

```

When I run the app I am not seeing any of the data points on the chart and my x axis appears to be in milliseconds (I have tried both datetime and date only objects with the same result):

![Screenshot 2020-02-20 at 11.18.09](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/b/b678316c9f7eb6764ec2f86f7dbdeb22af9dbf07.png)

Can anyone spot where I’m going wrong with this?

TIA

---

<div class="post-metadata">

**Author:** ![Chris369](https://avatars.discourse-cdn.com/v4/letter/c/82dd89/32.png) [@Chris369](https://community.plotly.com/u/Chris369)\
**Post date:** [February 20, 2020, 11:30am UTC](https://community.plotly.com/t/struggling-with-plotting-weekly-time-series-data/35234/2 "2020-02-20T11:30:28Z")

</div>

after posting the above I noticed the rouge ` dtype=object` in my x values

But having now remove that I am still seeing the same output with my x & y from the figure looking like this:

```auto
'x': [2019-12-30, 2020-01-06, 2020-01-13, 2020-01-20, 2020-01-27, 2020-02-03,
          2020-02-10],
    'y': array([[0],
                [0],
                [0],
                [0],
                [0],
                [716],
                [890]]),

```

---

<div class="post-metadata">

**Author:** ![Chris369](https://avatars.discourse-cdn.com/v4/letter/c/82dd89/32.png) [@Chris369](https://community.plotly.com/u/Chris369)\
**Post date:** [February 20, 2020, 11:43am UTC](https://community.plotly.com/t/struggling-with-plotting-weekly-time-series-data/35234/3 "2020-02-20T11:43:07Z")

</div>

Ok solved it - my y’s are arrays and using np.flatten() solved it
