szaydel
9/8/2017 - 4:06 PM

[GNUplot snippets] Examples and reminders for generating quick and dirty plots with GNUplot #gnuplot #plotting #graphs #visualizations #stat

[GNUplot snippets] Examples and reminders for generating quick and dirty plots with GNUplot #gnuplot #plotting #graphs #visualizations #stats #summary

# Plot assumes data is coming from this dataset:
# https://github.com/gnuplot/gnuplot/raw/master/demo/energy_circles.dat
#
# set terminal pngcairo  transparent enhanced font "arial,10" fontscale 1.0 size 600, 400 
# set output 'boxplot.3.png'
set border 2 front lt black linewidth 1.000 dashtype solid
set boxwidth 0.5 absolute
set style fill   solid 0.50 border lt -1
unset key
set pointsize 0.5
set style data boxplot
set xtics border in scale 0,0 nomirror norotate  autojustify
set xtics norangelimit 
set xtics ()
set ytics border in scale 1,0.5 nomirror norotate  autojustify
set title "Distribution of energy usage of the continents, grouped by type of energy source,\n assign individual colors (linetypes) to the factors taken from column 4\n" 
set ylabel "Billion Tons of Oil Equivalent" 
## Last datafile plotted: "energy_circles.dat"
plot 'energy_circles.dat' using (1):($8/1.e6):(0):4 lt 51 lc variable
# σ(x) Function
set terminal qt font "Fira Sans Light,12"
set xrange [-6:6]
set xzeroaxis linetype -1
set yzeroaxis linetype -1
set xtics axis nomirror
set ytics axis nomirror 0,0.5,1
set key off
set grid
set border 1
set samples 400
plot exp(x)/(1 + exp(x)) with line linetype rgbcolor "red" linewidth 2
# Print a 3 column CSV where first column is bandwidth,
# second iops and third is direction of IO.

set auto fix
set offsets 1000,1000,1000,1000
set datafile separator ","
set key title "IO Direction" center font "Open Sans Bold,13"
set key inside right top font "Open Sans,12"
set title "IOPS to Bandwidth Relationship" font "Open Sans,18"
set xlabel "IOPS" font "Open Sans Bold,14"
set ylabel "BW (KBps)" font "Open Sans Bold,14"
plot \
"/Users/szaydel/racktop/perf-analysis/testing/nfs41/bw_iops.csv" \
    using 2:($3 == 0 ? 1/0 : $1) \
    w points pt 7 lc rgb "royalblue" \
    title "Reads", \
"/Users/szaydel/racktop/perf-analysis/testing/nfs41/bw_iops.csv" \
    using 2:($3 != 0 ? 1/0 : $1) \
    w points pt 9 lc rgb "dark-yellow" \
    title "Writes"
# Use first column for joining and then plot using column 2 as X and 5 as Y
set auto fix
set offsets 1000,1000,15000,10000
set xlabel "IOPS" font "Open Sans,14" ; set ylabel "BW (KBps)" font

set title "IOPS to Bandwidth Relationship <Before>" font "Open Sans,18"
plot "< join -1 1 001a_iops-before.csv 001a_bw-before.csv" using 2:5 pt 4

set title "IOPS to Bandwidth Relationship <After>" font "Open Sans,18"
plot "< join -1 1 001a_iops-after.csv 001a_bw-after.csv" using 2:5 pt 4

#!/usr/local/Cellar/gnuplot/5.2.0/bin/gnuplot -persist
#
#
#    	G N U P L O T
#    	Version 5.2 patchlevel 0    last modified 2017-09-01
#
#    	Copyright (C) 1986-1993, 1998, 2004, 2007-2017
#    	Thomas Williams, Colin Kelley and many others
#
#    	gnuplot home:     http://www.gnuplot.info
#    	faq, bugs, etc:   type "help FAQ"
#    	immediate help:   type "help"  (plot window: hit 'h')
# set terminal qt 0 font "Sans,9"
# set output
unset clip points
set clip one
unset clip two
set errorbars front 1.000000
set border 31 front lt black linewidth 1.000 dashtype solid
set zdata
set ydata
set xdata
set y2data
set x2data
set boxwidth
set style fill  empty border
set style rectangle back fc  bgnd fillstyle   solid 1.00 border lt -1
set style circle radius graph 0.02
set style ellipse size graph 0.05, 0.03 angle 0 units xy
set dummy x, y
set format x "% h"
set format y "% h"
set format x2 "% h"
set format y2 "% h"
set format z "% h"
set format cb "% h"
set format r "% h"
set ttics format "% h"
set timefmt "%d/%m/%y,%H:%M"
set angles radians
set tics back
unset grid
unset raxis
set theta counterclockwise right
set style parallel front  lt black linewidth 2.000 dashtype solid
set key title "" center
set key fixed right top vertical Right noreverse enhanced autotitle nobox
set key noinvert samplen 4 spacing 1 width 0 height 0
set key maxcolumns 0 maxrows 0
set key noopaque
unset label
unset arrow
set style increment default
unset style line
unset style arrow
set style histogram clustered gap 2 title textcolor lt -1
unset object
set style textbox transparent margins  1.0,  1.0 border  lt -1 linewidth  1.0
set offsets 0, 0, 0, 0
set pointsize 1
set pointintervalbox 1
set encoding default
unset polar
unset parametric
unset decimalsign
unset micro
unset minussign
set view 60, 30, 1, 1
set view azimuth 0
set samples 100, 100
set isosamples 10, 10
set surface
unset contour
set cntrlabel  format '%8.3g' font '' start 5 interval 20
set mapping cartesian
set datafile separator whitespace
unset hidden3d
set cntrparam order 4
set cntrparam linear
set cntrparam levels auto 5
set cntrparam points 5
set size ratio 0 1,1
set origin 0,0
set style data points
set style function lines
unset xzeroaxis
unset yzeroaxis
unset zzeroaxis
unset x2zeroaxis
unset y2zeroaxis
set xyplane relative 0.5
set tics scale  1, 0.5, 1, 1, 1
set mxtics default
set mytics default
set mztics default
set mx2tics default
set my2tics default
set mcbtics default
set mrtics default
set nomttics
set xtics border in scale 1,0.5 mirror rotate by -270  autojustify
set xtics  norangelimit
set xtics   ()
set ytics border in scale 1,0.5 mirror norotate  autojustify
set ytics  norangelimit logscale autofreq
set ztics border in scale 1,0.5 nomirror norotate  autojustify
set ztics  norangelimit autofreq
unset x2tics
unset y2tics
set cbtics border in scale 1,0.5 mirror norotate  autojustify
set cbtics  norangelimit autofreq
set rtics axis in scale 1,0.5 nomirror norotate  autojustify
set rtics  norangelimit autofreq
unset ttics
set title "Kernel Allocated Memory in Megabytes Log-Scaled"
set title  font "Open Sans,18" norotate
set timestamp bottom
set timestamp ""
set timestamp  font "" norotate
set trange [ * : * ] noreverse nowriteback
set urange [ * : * ] noreverse nowriteback
set vrange [ * : * ] noreverse nowriteback
set xlabel "Kernel Constituents"
set xlabel  font "Open Sans,14" textcolor lt -1 norotate
set x2label ""
set x2label  font "" textcolor lt -1 norotate
set xrange [ * : * ] noreverse nowriteback
set x2range [ * : * ] noreverse nowriteback
set ylabel "Log(10) Scaled Bytes Used"
set ylabel  font "Open Sans,14" textcolor lt -1 rotate
set y2label ""
set y2label  font "" textcolor lt -1 rotate
set yrange [ 0.100000 : 10000.0 ] noreverse nowriteback
set y2range [ * : * ] noreverse nowriteback
set zlabel ""
set zlabel  font "" textcolor lt -1 norotate
set zrange [ * : * ] noreverse nowriteback
set cblabel ""
set cblabel  font "" textcolor lt -1 rotate
set cbrange [ * : * ] noreverse nowriteback
set rlabel ""
set rlabel  font "" textcolor lt -1 norotate
set rrange [ * : * ] noreverse nowriteback
unset logscale
set logscale y 10
unset jitter
set zero 1e-08
set lmargin  -1
set bmargin  -1
set rmargin  -1
set tmargin  -1
set locale "en_US.UTF-8"
set pm3d explicit at s
set pm3d scansautomatic
set pm3d interpolate 1,1 flush begin noftriangles noborder corners2color mean
set pm3d nolighting
set palette positive nops_allcF maxcolors 0 gamma 1.5 color model RGB
set palette rgbformulae 7, 5, 15
set colorbox default
set colorbox vertical origin screen 0.9, 0.2 size screen 0.05, 0.6 front  noinvert bdefault
set style boxplot candles range  1.50 outliers pt 7 separation 1 labels auto unsorted
set loadpath
set fontpath
set psdir
set fit brief errorvariables nocovariancevariables errorscaling prescale nowrap v5
GNUTERM = "qt"
## Last datafile plotted: "cloudbsrvmem.dat"
plot "cloudbsrvmem.dat" using 0:(int($2)>>20):xtic(1) title "memory (MB)" with boxes fs solid border -1 fc rgbcolor("goldenrod")
#    EOF
# Data 'input.dat'
fruits price
apple 0.69
melon 4.99
orange 1.02
mandarin 1.30
kiwi 0.98
banana 0.33
peach 1.23

# GNUplot
# Plot points
set auto fix
set offsets 2,2,2,2
plot "input.dat" using (column(0)):2:xtic(1) ti col with points ps 3 pt 9

# Plot boxes instead of points
set auto fix
set offsets 1,0,0,0
set style fill solid border -1
plot "input.dat" using (column(0)):2:xtic(1) ti col with boxes fs solid fc rgbcolor("goldenrod") lw 1
# Without explicitly setting solid border, we can pass it in the plot command
plot "input.dat" using (column(0)):2:xtic(1) ti col with boxes \
fs solid border -1 \
fc rgbcolor("goldenrod") lw 1