Marc Kupietz | 12a9fe8 | 2020-06-16 14:27:57 +0200 | [diff] [blame] | 1 | #!/usr/bin/env python3 |
Marc Kupietz | ca08069 | 2020-06-19 18:06:46 +0200 | [diff] [blame] | 2 | from KorAPClient import KorAPClient |
Marc Kupietz | 12a9fe8 | 2020-06-16 14:27:57 +0200 | [diff] [blame] | 3 | import plotly.express as px |
Marc Kupietz | 12a9fe8 | 2020-06-16 14:27:57 +0200 | [diff] [blame] | 4 | |
| 5 | QUERY = "Hello World" |
| 6 | YEARS = range(2010, 2019) |
| 7 | COUNTRIES = ["DE", "CH"] |
| 8 | |
Marc Kupietz | ca08069 | 2020-06-19 18:06:46 +0200 | [diff] [blame] | 9 | kcon = KorAPClient.KorAPConnection(verbose=True) |
Marc Kupietz | 12a9fe8 | 2020-06-16 14:27:57 +0200 | [diff] [blame] | 10 | |
| 11 | vcs = ["textType=/Zeit.*/ & pubPlaceKey=" + c + " & pubDate in " + str(y) for c in COUNTRIES for y in YEARS] |
Marc Kupietz | ca08069 | 2020-06-19 18:06:46 +0200 | [diff] [blame] | 12 | df = KorAPClient.ipm(KorAPClient.frequencyQuery(kcon, QUERY, vcs)) |
Marc Kupietz | 12a9fe8 | 2020-06-16 14:27:57 +0200 | [diff] [blame] | 13 | df['Year'] = [y for c in COUNTRIES for y in YEARS] |
| 14 | df['Country'] = [c for c in COUNTRIES for y in YEARS] |
| 15 | |
| 16 | fig = px.line(df, title=QUERY, x="Year", y="ipm", color="Country", |
| 17 | error_y="conf.high", error_y_minus="conf.low") |
| 18 | fig.show() |