aboutsummaryrefslogtreecommitdiff
path: root/content/notes
diff options
context:
space:
mode:
authorMitja Felicijan <m@mitjafelicijan.com>2023-08-01 17:20:00 +0200
committerMitja Felicijan <m@mitjafelicijan.com>2023-08-01 17:20:00 +0200
commitd25abcc5492fb2907350840b78fc62c2a402c61f (patch)
tree82841a2a99ad3bb3207c00e464e57d00d29dc993 /content/notes
parent2efe4bc1a966da188da450782d8d74690933526b (diff)
downloadmitjafelicijan.com-d25abcc5492fb2907350840b78fc62c2a402c61f.tar.gz
Note: Added more context to SVG charts note
Diffstat (limited to 'content/notes')
-rw-r--r--content/notes/2023-08-01-make-b-w-svg-charts-with-matplotlib.md24
1 files changed, 21 insertions, 3 deletions
diff --git a/content/notes/2023-08-01-make-b-w-svg-charts-with-matplotlib.md b/content/notes/2023-08-01-make-b-w-svg-charts-with-matplotlib.md
index 50c3806..c3fef57 100644
--- a/content/notes/2023-08-01-make-b-w-svg-charts-with-matplotlib.md
+++ b/content/notes/2023-08-01-make-b-w-svg-charts-with-matplotlib.md
@@ -10,18 +10,34 @@ Install pip requirements.
10 10
11```sh 11```sh
12pip install matplotlib 12pip install matplotlib
13pip install numpy
14pip install pandas 13pip install pandas
15``` 14```
16 15
17Now execute the script. 16Example of data being used.
17
18```csv
19Epoch,Connect (NLB),Processing (NLB),Waiting (NLB),Total (NLB),Connect (ALB),Processing (ALB),Waiting (ALB),Total (ALB)
201,57.7,315.7,309.4,321.6,9,104.4,98.3,105.7
212,121.9,114.4,100.3,176.9,5.8,99.1,97.1,101.1
223,5.3,229.4,231.2,231.4,14.2,83,69.4,87.9
234,4.2,134.5,112.2,135.3,5.3,132.4,105.5,134.1
245,5.8,247.4,246.8,248.1,6,74.3,70.2,75.5
256,9.9,122.9,100.6,122.7,7.5,241.1,79.3,242.3
267,6.1,170.2,106.4,170.5,7.2,382.4,375.1,383.8
278,6.6,194.3,201.4,195.5,7.1,130.9,104.8,132.6
289,6.4,146.1,122.3,147.7,9.4,95.6,74,96.4
29```
30
31In the code you can use `df` as dataframes and use the headers like `df["Epoch"]`.
32This is how you get a column data with pandas.
33
34The Python code responsible for generating a chart:
18 35
19```python 36```python
20import csv 37import csv
21import sys 38import sys
22 39
23import matplotlib.pyplot as plt 40import matplotlib.pyplot as plt
24import numpy as np
25import pandas as pd 41import pandas as pd
26 42
27# Read the data 43# Read the data
@@ -49,3 +65,5 @@ plt.savefig("plot.svg", format="svg")
49``` 65```
50 66
51![SVG Chart](/notes/plot.svg) 67![SVG Chart](/notes/plot.svg)
68
69The image above is SVG and you can zoom in and out and check that the image is vector.