blob: 126b3bfe5d9e0f4321bf840e2158fe9c0bc78ecf [file] [log] [blame]
Marc Kupietz12a9fe82020-06-16 14:27:57 +02001#!/usr/bin/env python3
Marc Kupietzca080692020-06-19 18:06:46 +02002from KorAPClient import KorAPClient
Marc Kupietz12a9fe82020-06-16 14:27:57 +02003import plotly.express as px
Marc Kupietz12a9fe82020-06-16 14:27:57 +02004
5QUERY = "Hello World"
6YEARS = range(2010, 2019)
7COUNTRIES = ["DE", "CH"]
8
Marc Kupietzca080692020-06-19 18:06:46 +02009kcon = KorAPClient.KorAPConnection(verbose=True)
Marc Kupietz12a9fe82020-06-16 14:27:57 +020010
11vcs = ["textType=/Zeit.*/ & pubPlaceKey=" + c + " & pubDate in " + str(y) for c in COUNTRIES for y in YEARS]
Marc Kupietzca080692020-06-19 18:06:46 +020012df = KorAPClient.ipm(KorAPClient.frequencyQuery(kcon, QUERY, vcs))
Marc Kupietz12a9fe82020-06-16 14:27:57 +020013df['Year'] = [y for c in COUNTRIES for y in YEARS]
14df['Country'] = [c for c in COUNTRIES for y in YEARS]
15
16fig = px.line(df, title=QUERY, x="Year", y="ipm", color="Country",
17 error_y="conf.high", error_y_minus="conf.low")
18fig.show()