✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐍Plotly, Coiled CEOs Discuss Partnering & ML Experts show us how Dash + Dask apps work Register for the Webinar.

CSV File used with Range Example

Hello!

I was trying to follow the example that poorly had for the range slider and button graph: https://plot.ly/python/range-slider/

However I can’t seem to get it to work. I get the Y axis and my color scale working fine, however the X axis and my points don’t show up. I’m pretty sure it has to do with the DATETIME aspect of the graph… Thank you in advance for your help, and I apologize if this is super easy or silly mistake!

W

import plotly.graph_objs as go

import plotly.plotly as py
import pandas as pd
import numpy as np
import datetime

df = pd.read_csv(‘temp_data.csv’)

trace1 = go.Scattergl(
x= df[‘Dates’],
y= df[‘Temp’],
mode=‘markers’,
marker=dict(
size=‘16’,
cmin=0,
cmax=25,

    color = df.Time,#set color equal to a variable
    colorscale='Greys',

colorscale=[[0,’(#dc143c)’],[17,’(#000080)’]],# [24,‘rgb(93,206,175)’]],

    showscale=True
)

)
data = [trace1]

layout = go.Layout(
xaxis=dict(
rangese
rangeselector=dict(
buttons=list([
dict(count=1,
label=‘1m’,
step=‘month’,
stepmode=‘forward’),
dict(count=6,
label=‘6m’,
step=‘month’,
stepmode=‘forward’),
dict(count=1,
label=‘YTD’,
step=‘year’,
stepmode=‘todate’),
dict(count=1,
label=‘1y’,
step=‘year’,
stepmode=‘forward’),
dict(step=‘all’)
])
),
rangeslider=dict(),
type=‘date’
)

,
yaxis=dict(
range = [65,90]
)
)
fig = go.Figure(data=[trace1], layout = layout)

py.plot(fig, filename='plot_for_poster