Xianwei Zhang / https://people.cs.pitt.edu/~xianeizhang/
- shell file fetches data paths
top-level shell file '*.sh' gets data file paths from cfg file 'cfgs/para.cfg';
- shell file scan the specified data path
within the data path, '*.sh' scans to find data file (*.dat) and figure property file (*.cfg);
- draw
'*.sh' then calls the corresponding python file to draw;
- python calling format
python python_file data_file figure_cfg_file section_name_in_figure_cfg_file e.g.,
python $PY_DIR/bar.py $data $bar_CFG_DIR/bar.cfg “read ratio figure”
- generated figure files (*.eps/*.png/*.pdf, …) are saved into the data file directory;
Note: file name is automatically created by appending figure extension to data file
- provide the ‘*.pdf’ (by default, *.eps are converted to *.pdf) file path to your latex file.
e.g.,
\includegraphics[width=3in]{figures/rst/DATA/{stat_energyEDP.dat}.pdf}
- prepare your data in the required format (see example data files or *.dat.format files;
- if you are collecting data with scripts, then it is easy to follow the format;
- write up shell file and specify data path
- edit ‘cfgs/para.cfg’ and shell file to locate your data files;
- update the figure cfg file (e.g., figure size, color, pattern and gap, etc);
- Note: I tried to make as many settings be not hard-coded. However, to avoid messy config, many others (e.g., major/minor ticks and figure dpi, etc) are still hard coded in the python files. If you need different settings of such parameters, then please hack the python files;
- set figure properties, e.g., height/width, pattern, color, ...
- specify which figure cfg file (bar.cfg/stacked.cfg/y2.cfg) to use and set the section (e.g., "xxx figure") for each figure.
The top *.sh file can be written as follow
1 #!/bin/bash
2
3 #-- directory of path cfg file, i.e., para.cfg
4 CFG_DIR="./cfgs"
5 #-- directory of python files
6 PY_DIR="./pythons"
7
8 #-- include para.cfg to specify data file path
9 . $CFG_DIR/para.cfg
10
11 scatter_CFG_DIR=$scatter_DATA_DIR #-- figure cfg file is put together with data file
12
13 #-- scan data files in the directory
14 for data in $(find $scatter_DATA_DIR -mindepth 1 -maxdepth 1 -type f -name "*.dat")
15 do
16 #--figure of memory comparison
17 if [[ $data == *memory_comp.dat* ]]; then
18 echo $data
19 python $PY_DIR/scatter.py $data $scatter_CFG_DIR/scatter.cfg "memory comp figure"
20 fi
21 [ -f ${data}.eps ] && `epstopdf ${data}.eps && rm ${data}.eps`
22 done
Note that PNG images are for this README only, the output figure is in PDF.
- historic bar
- stacked bar
- double y axis
- line
- log line (axis in log scale)
- sub plot (multiple sub plots in one single figure)
- scatter
- function plot (plot using some curve functions instead of data samples)
- README: this file
- *.figures.sh : shell file to call python
- pythons/: python graph files
- cfgs/: data path configuration files
- DATA/: source data files
- example paper/: main figures in the paper were created with those scripts
- historic bar
- sh: bar.figures.sh
- py: bar.py
- path cfg: cfgs/para.cfg
- draw cfg: bar.test.DATA/bar.cfg
- data: bar.test.DATA/*.dat
- out: bar.test.DATA/*.pdf
- stacked bar
- sh: stacked.figures.sh
- py: stacked/stacked_[12].py
- path cfg: cfgs/para.cfg
- draw cfg: stacked.test.DATA/stacked.cfg
- data: stacked.test.DATA/*.dat
- out: stacked.test.DATA/*.pdf
- double y axis
- sh: y2.figures.sh
- py: y2.py
- path cfg: cfgs/para.cfg
- draw cfg: cfgs/y2.cfg
- data: y2.test.DATA/*.dat
- out: y2.test.DATA/*.pdf
- line (will be updated later)
sh: {line/log_line/subp_line}.figures.sh
py: {line/usual_line/log_line/subp_line}.py
path cfg: cfgs/para.cfg
- draw cfg:
- line.test.DATA/line.cfgline.test.DATA/usual_line.cfglog_line.test.DATA/log_line.cfgsubp_line.test.DATA/subp_line.cfg
data: *.test.DATA/*.dat
out: *.test.DATA/*.pdf
- func (will be improved later)
- sh: func.figures.sh
- py: func/{leak/rc/tret_20nm/tret_60nm}.py
- path cfg: cfgs/para.cfg
- draw cfg: func.test.DATA/{leak/rc/tret}.cfg
- data: func.test.DATA/*.dat
- out: func.test.DATA/*.pdf