Skip to content

Commit a1d123b

Browse files
authored
Simplify install instructions and add plotting example (#267)
Remove the hardcoded version from the pip install command — users should just install the latest by default. Add a matplotlib plotting example at the end of the README showing how to visualize fetched data.
2 parents da122e0 + 5bbaa9d commit a1d123b

1 file changed

Lines changed: 29 additions & 3 deletions

File tree

README.md

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ for a practical example of how to use the client.
3434
### Installation
3535

3636
```bash
37-
# Choose the version you want to install
38-
VERSION=0.18.0
39-
pip install frequenz-client-reporting==$VERSION
37+
pip install frequenz-client-reporting
4038
```
4139

4240

@@ -202,6 +200,34 @@ df = pd.DataFrame(data)
202200
print(df)
203201
```
204202

203+
## Plotting data with matplotlib
204+
205+
```bash
206+
pip install matplotlib
207+
```
208+
209+
Using the `data` variable from any of the examples above:
210+
211+
```python
212+
import matplotlib.pyplot as plt
213+
import matplotlib.dates as mdates
214+
215+
timestamps = [s.timestamp for s in data]
216+
values = [s.value for s in data]
217+
218+
fig, ax = plt.subplots(figsize=(14, 5))
219+
ax.plot(timestamps, values)
220+
221+
# Optional: customize the plot
222+
ax.set_title("AC Active Power")
223+
ax.set_ylabel("Power (W)")
224+
ax.xaxis.set_major_formatter(mdates.DateFormatter("%H:%M"))
225+
ax.grid(True)
226+
fig.tight_layout()
227+
228+
plt.show()
229+
```
230+
205231
## Command line client tool
206232

207233
The package contains a command-line tool that can be used to request

0 commit comments

Comments
 (0)