In [17]:
import pandas as pd
import numpy as np
import plotly.plotly as py
import plotly.graph_objs as go

currencies = pd.read_csv("https://raw.githubusercontent.com/democratia/political_science/master/Daten/devisenanlagen-prozent-snb.csv", sep=",")

columns = list(currencies)[1:-1]
print(columns)
N = len(columns)
quartal = currencies["Quartal"]

traces = []
curr_sum = np.zeros((1, len(quartal)))
for i, curr in zip(range(0, N), columns):
    curr_sum = curr_sum + currencies[curr].values
    traces.append(go.Scatter(
        x=quartal,
        y=curr_sum.T,
        mode='lines',
        connectgaps=True,
        name = curr,
        fill='tonexty',
        text=np.round(currencies[curr].values, 2),
        hoverinfo='x+text',
    ))
layout = go.Layout(
        title='Devisenanlagen der SNB',
        xaxis=dict(title='Quartal'),
        yaxis=dict(title='Anteil in %')
    )
fig = go.Figure(data=traces, layout=layout)    
py.iplot(fig, filename='devisen-prozent-snb')


['USD', 'EUR', 'JPY', 'GBP', 'CAD', 'übrige']
Out[17]:

In [ ]: