fig = px.line(cfg, x="Date", y="N", template=chartTemplate)
fig.update_layout({"title": 'Casos - Cienfuegos',
                   "xaxis": {"title":"Días"},
                   "yaxis": {"title":"Casos"},
                   "showlegend": False})
fig.show()
bars = 'accelMeans7'
#bars = 'accelMeans3'
#bars = 'acc'
#bars = 'vel'
cfg['color'] = cfg.apply(lambda x: 'green' if x['accelMeans7'] <= 0 else 'red', axis=1)
fig = go.Figure()
### Traces
# Line
fig.add_trace(go.Scatter( #type= 'area',
    x = cfg['Date'],
    y = cfg['accelMeans14'], #cfg[cfg['accelMeans14']<0]['accelMeans14'], #y = ,
    name = 'Aceleración 14d',
    line = dict(
        color = 'blue', # cuba['color'],
        width = 1.5)
))
# Bars
fig.add_trace(go.Bar(
    x=cfg['Date'], 
    y=cfg[bars], 
    name='Aceleración 3d', 
    opacity=0.5,
    marker=dict(color=cfg['color']),
    yaxis = 'y2'
))
# First apply general tamplate
fig.update_layout(template = chartTemplate)
### New spec Layout
layout = {'title': 'Aceleración de casos - promedio móvil 14 días (línea) - 3 días (barras) - Cuba',
             "width" : 800,
            "height" : 500,
            'font' : {
                'family': "Arial",
                'size': 12,
                'color': 'rgb(96, 96, 96)' #"gray"
            },
            'xaxis': {
                'dtick': '30',
                'tickformat': '%d %B',
                'showline': True,
                'showgrid': False,
                'showticklabels': True,
                'linecolor': 'rgb(204, 204, 204)',
                'linewidth': 2,
                'ticks': 'outside',
                'tickfont': dict(
                    family='Arial',
                    size=12,
                    color='rgb(82, 82, 82)',
        ),
            },
            'yaxis': {
                    'zerolinecolor': 'black',
                    'zerolinewidth': 1,
                    'rangemode': 'tozero',
                    #'gridcolor': 'gray',
                    #'gridwidth': 0.1
                    #'range': [150,-150]
            },
            'yaxis2': {
                    #'title': '3 dias',
                    'overlaying': 'y',
                    'side': 'right',
                    #'range': [250,-250],
                    'zerolinecolor': 'black',
                    'zerolinewidth': 1,
                },
            #'legend_title': "Legend Title",
            'legend': { 
                    'x': .1,
                    'y': .98
            }
         }
fig.update_layout(layout)
fig.write_image("figure.png")
fig.show()