A script written in python that plots data from a file or from a dataframe, outputs that graph as an image or pdf.
Description and valid values for each argument. Examples are presented in a different section.
Verbose | Short | Default | Description | Valid Values |
---|---|---|---|---|
--fileName | -f | required |
Name of the files that contain the data for the graph. It can be a directory as well, as long as there are csv files in it. | filename with or without path .extension / directory name with or without path |
--fileExtension | -ext | '.csv' | File extension to be chosen if a directory is passed. | string |
--dontSave | -ds | Saves the plot | Defines if plot will be saved. | - |
--displayPlot | -dp | Doesn't display the plot | Defines if plot will be displayed. | - |
--separator | -sep | ,(comma) | Defines the separator used in the input file, for parsing purposes. | ' ', '\t', regular expressions and other file delimiters |
--comment | -com | # | The character that will indicate if a line should be treated as comment. | string |
--output | -o | Name and/or extension of the output file. | '.png', 'name', 'name.png' |
Verbose | Short | Default | Description | Valid Values |
---|---|---|---|---|
--graphType | -g | line | Type of graph that will be plotted. | line, scatter, pie and bar |
--figSize | -fig | auto | Size of the graph and the exported image (Bounding Box). | float,float |
--plotTitle | -pt | none | Title that appears at the top of the plot. | string |
--fontSize | -fs | auto | Size of the font used in the graph itself. | int |
--showSpine | -st | Doesn't show | Shows the spines from the graph. | - |
--symbols | -s | point symbol | Shape of the symbols used. | Lists [ex: vhD] or values in https://matplotlib.org/3.1.0/api/markers_api.html |
--distBetSymbols | -d | auto | Distance between each symbol. | int |
--symbolSize | -ss | auto | Size of each symbol. | float |
--lineWidth | -l | auto | Size of the line on a Line plot. | int or float |
--pieLabel | -pl | none | Labels of the data in the pie plot. | string1,string2,...,stringN |
Verbose | Short | Default | Description | Valid Values |
---|---|---|---|---|
--x | -x | first column | The x-axis of the plot. | Indexes of columns * |
--y | -y | second column | The y-axis of the plot. | Indexes of columns(value, list [ex: 2,3,4] or sequences [ex: 2-4] * |
--xmax | -xmax | auto | Maximum value of x to be plotted. | float |
--xmin | -xmin | auto | Minimum value of x to be plotted. | float |
--ymax | -ymax | auto | Maximum value of y to be plotted. | float |
--ymin | -ymin | auto | Minimum value of y to be plotted. | float |
--xLabel | -xl | column name | Label of the x-axis. | string |
--yLabel | -yl | column name | Label of the y-axis. | string |
Verbose | Short | Default | Description | Valid Values |
---|---|---|---|---|
--setPalette | -p | colorblind | Graph color palette. | deep, muted, pastel, bright, dark and colorblind |
--bgColor | -bgc | lightgrey | Changes the color of the background. | 'red','black','lightyellow','#abc','#ff701E' ** |
--gColor | -gc | grey | Changes the color of the grid. | 'red','black','lightyellow','#abc','#ff701E' ** |
--colors | -c | cycles default colors | Selects the colors of the plotted y-axes in the scatter and line plots. | 'red','black','lightyellow','#abc','#ff701E |
Verbose | Short | Default | Description | Valid Values |
---|---|---|---|---|
--movingAverageWindow | -w | 1 | Plots the moving average, given the window | - |
--standardDeviation | -sd | Doesn't calculate | Makes a plot of the mean and the standard deviation over all the files, ploting the shadow. To plot standard deviation, there must be at least two files. If a directory is provided, it must only contain the files that are to be plotted. All files must have the same number of rows. | - |
--areaUnderCurve | -auc | Doesn't calculate | Calculates the area under the curve for a given file and the y index(es). If activated, doesn't generate a plot. Only accepts one file (if more than one files are given, will only calculate auc for the first file and ignore the others). | - |
--areaUnderCurveMethod | -aucm | 'simpson' | The method that is going to be used for the auc calculation. It can be the simpson rule, the trapezoidal rule or the mean of them. | 'simpson', 'trapz' or 'mean' |
- Column indexes begin at 1, not 0 ** See https://matplotlib.org/stable/tutorials/colors/colors.html for more examples *** 'lightblue', 'yellow', 'grey', 'lightpink', 'brown', 'pink', 'orange', 'green', 'dark yellow', 'blue'
- Line plot:
py plotme.py -f (path)filename.extension -x columnIndex -y columnIndex
- The only required argument is the filename
- Scatter plot with differente output name and plot title:
py plotme.py -f (path)file.ext -g scatter -pt title -o export
- Bar plot:
py plotme.py -f (path)filename.extension
- The first item in the column is interpreted as the label of the axis, the subsequent itens in that column NEED to be of type int or float
- Pie chart with labels on each slice while using a tab separated input file:
py plotme.py -f (path)filename.extension -sep '\t' -pl label,label2,...,labelN
- The first item in the column is interpreted as the label of the axis, the subsequent itens in that column NEED to be of type int or float
- Each label corresponds to a single slice in the chart, from 1 to N, every label is assigned a slice following the file order. The number of labels need to be the same as the number of elements in the column.
- f:
`python3 plotme.py -f 'name with spaces.csv'`
- ext:
`python3 plotme.py -f dir -y 3-5 -sd -ext txt`
- sp:
`python3 plotme.py -f dir -sp False`
- dp:
`python3 plotme.py -f dir -dp True`
- separator:
`python3 plotme.py -f file.txt -sep \t`
`python3 plotme.py -f file.csv -sep ,`
`python3 plotme.py -f file.csv -sep ' '`
- com:
`python3 plotme.py -f file -com @`
- output:
`python3 plotme.py -f file -o outputFile`
`python3 plotme.py -f file -o .tiff`
`python3 plotme.py -f file -o export.jpeg`
- graphType:
`python3 plotme.py -f file -g bar`
- figSize:
`python3 plotme.py -f file -fig 192,108`
- plotTitle:
`python3 plotme.py -f file -pt 'Tile of the plot'`
- fontSize:
`python3 plotme.py -f file -fs 14`
- hideSpine:
`python3 plotme.py -f file -st True`
- symbols:
`python3 plotme.py -f file -y 2,3 -s vH`
`python3 plotme.py -f file -y 2-6 -s vHDdv`
`python3 plotme.py -f file -y 2-6 -s v`
- distBetSymbols:
`python3 plotme.py -f file -d 3`
- symbolSize:
`python3 plotme.py -f file -s v -ss 15`
- lineWidth:
`python3 plotme.py -f file -l 15`
- pieLabel:
`python3 plotme.py -f file -g pie -pl slice1,'another slice',3`
- x:
`python3 plotme.py -f file -x 1`
- y:
`python3 plotme.py -f file -y 5-7`
`python3 plotme.py -f file -y 5,6,7`
- xmax:
`python3 plotme.py -f file -xmax 10`
- xmin:
`python3 plotme.py -f file -xmin 10`
- ymax:
`python3 plotme.py -f file -ymax 10`
- ymin:
`python3 plotme.py -f file -ymin 10`
- xLabel:
`python3 plotme.py -f file -xl 'label of x'`
- yLabel:
`python3 plotme.py -f file -yl 'label of y'`
- setPalette:
`python3 plotme.py -f file -p deep`
- bgColor:
`python3 plotme.py -f file -bgc black`
`python3 plotme.py -f file -bgc '#ff701E'`
- gColor:
`python3 plotme.py -f file '#abc'`
- colors:
`python3 plotme.py -f file -y 2,4 -c yellow,green`
`python3 plotme.py -f file -y 2,4 -c '#ff701E','#abc'`
- w:
`python3 plotme.py -f file1 -w 100`
`python3 plotme.py -f file1 file2 file3 [...] -y 2 -sd -w 1000`
- sd:
`python3 plotme.py -f file1 file2 file3 [...] -y 2 -sd`
`python3 plotme.py -f file1 file2 file3 -y 2-4,7 -sd`
`python3 plotme.py -f directory -y 2 -sd`
- auc:
`python3 plotme.py -f file -y 4-6 -auc`
`python3 plotme.py -f file1 file2 file3 [...] -y 3,4 -auc`
- aucm:
`python3 plotme.py -f file -y 4-6 -auc -aucm simpson`
`python3 plotme.py -f file1 file2 file3 [...] -y 3,4 -auc -aucm trapz`
- After importing, you need to make an instance of the
Plot
class while passing, at least, thedata
(the imported version of fileName) argument with the dataframe, the rest of the arguments have the same names as their CLI counterparts. - Call the
plotGraph()
method. The file will be exported asPlot.pdf
if nooutput
argument was passed.