blob: 6ac91cc5ad3809aaad614283a53dd6fbc43bfe52 [file] [log] [blame]
Marc Kupietz12a9fe82020-06-16 14:27:57 +02001#!/usr/bin/env python3
Marc Kupietz6d539742020-06-25 18:33:20 +02002from KorAPClient import KorAPClient, KorAPConnection
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 Kupietz6d539742020-06-25 18:33:20 +02009kcon = 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 Kupietz6d539742020-06-25 18:33:20 +020012df = KorAPClient.ipm(kcon.frequencyQuery(QUERY, vcs))
13print(df)
14
Marc Kupietz12a9fe82020-06-16 14:27:57 +020015df['Year'] = [y for c in COUNTRIES for y in YEARS]
16df['Country'] = [c for c in COUNTRIES for y in YEARS]
17
18fig = px.line(df, title=QUERY, x="Year", y="ipm", color="Country",
19 error_y="conf.high", error_y_minus="conf.low")
20fig.show()