... | ... | @@ -81,8 +81,8 @@ $ sudo apt-get install python3 pandas |
|
|
$ sudo apt-get install python3-matplotlib
|
|
|
$ sudo apt-get install python-pip
|
|
|
|
|
|
pip install nbconvert
|
|
|
pip install jupyter_client
|
|
|
$ pip install nbconvert
|
|
|
$ pip install jupyter_client
|
|
|
```
|
|
|
### Producing a notebook with plots
|
|
|
|
... | ... | @@ -125,11 +125,21 @@ def load_datafile(basename): |
|
|
times[:] = [x - tmpVal for x in times]
|
|
|
return pd.DataFrame({"Time": times, "Latency": values, "Frequency1": frequency1, "Frequency2": frequency2, "Frequency3": frequency3, "Frequency4": frequency4})
|
|
|
```
|
|
|
Then add some global variables in order to scale the axes into seconds (from us in the data):
|
|
|
|
|
|
```python
|
|
|
scale = 1e6
|
|
|
ticks = ticker.FuncFormatter(lambda x, pos: '{0:g}'.format(x/scale))
|
|
|
```
|
|
|
|
|
|
Then to plot, simply use the code:
|
|
|
|
|
|
```python
|
|
|
load_datafile(<filename>).plot(title=<title>, x="Time", y="Latency", linewidth=0.5)
|
|
|
ax = plt.gca()
|
|
|
ax.xaxis.set_major_formatter(ticks)
|
|
|
plt.xlabel("Time (s)")
|
|
|
plt.ylabel("Latency (us)")
|
|
|
```
|
|
|
|
|
|
To add multiple files as subplots, define an array of axes for the plots to use (each subplot is one array element), then in `plot()` add an argument `ax=axes[n]` defining which subplot to use. Note that 2D arrays can be used to plot subplots in grids (i.e. 4 plots in a 2x2 grid).
|
... | ... | |