Use Altair/Vega-Lite instead of Plotly express in Readme.md
Change-Id: I8f22c23715af9944bcf5f4595f0ab07b1a3381fd
diff --git a/Readme.md b/Readme.md
index 335a3c5..9f25ab1 100644
--- a/Readme.md
+++ b/Readme.md
@@ -67,26 +67,18 @@
## Examples
#### Frequencies of "Hello World" over years and countries
```python
+import altair as alt
+import pandas as pd
from KorAPClient import KorAPClient, KorAPConnection
-import plotly.express as px
QUERY = "Hello World"
-YEARS = range(2010, 2019)
-COUNTRIES = ["DE", "CH"]
+df = pd.DataFrame(range(2010, 2019), columns=["Year"], dtype=str) \
+ .merge(pd.DataFrame(["DE", "CH"], columns=["Country"]), how="cross")
+df["vc"] = "textType=/Zeit.*/ & pubPlaceKey = " + df.Country + " & pubDate in " + df.Year
+df = KorAPClient.ipm(KorAPConnection().frequencyQuery(QUERY, df.vc)).merge(df)
-kcon = KorAPConnection(verbose=True)
-
-vcs = [f"textType=/Zeit.*/ & pubPlaceKey={c} & pubDate in {y}" for c in COUNTRIES for y in YEARS]
-df = KorAPClient.ipm(kcon.frequencyQuery(QUERY, vcs))
-
-df['Year'] = [y for c in COUNTRIES for y in YEARS]
-df['Country'] = [c for c in COUNTRIES for y in YEARS]
-df['error_y'] = df["conf.high"] - df["ipm"]
-df['error_y_minus'] = df["ipm"] - df["conf.low"]
-
-fig = px.line(df, title=QUERY, x="Year", y="ipm", color="Country",
- error_y="error_y", error_y_minus="error_y_minus")
-fig.show()
+alt.Chart(df).mark_line(point=True).encode(y="ipm", x="Year:T", color="Country", href="webUIRequestUrl") \
+ .properties(title=QUERY).show()
```
![Frequency per million words of “Hello World“ in DE vs. AT from 2010 to 2018 in newspapers and magazines](figures/hello-world.png)
diff --git a/figures/hello-world.png b/figures/hello-world.png
index 58579df..031872d 100644
--- a/figures/hello-world.png
+++ b/figures/hello-world.png
Binary files differ