More
author |
Steve Losh <steve@stevelosh.com> |
date |
Wed, 12 Feb 2020 11:50:57 -0500 |
parents |
90aa89efde4f |
children |
a20cd97bae84 |
# Basic Settings ---------------------------------------------------------- {{{
set encoding utf8
set terminal qt noraise
set samples 1000
# }}}
# Styles ------------------------------------------------------------------ {{{
set grid
set palette defined (0 '#fef0d9', 1 '#fdcc8a', 2 '#fc8d59', 3 '#d7301f')
set linetype 1 linewidth 2 pointtype 7 ps 1.0 linecolor rgb '#1f78b4'
set linetype 2 linewidth 2 pointtype 5 ps 1.0 linecolor rgb '#33a02c'
set linetype 3 linewidth 2 pointtype 9 ps 1.4 linecolor rgb '#e31a1c'
set linetype 4 linewidth 2 pointtype 7 ps 1.0 linecolor rgb '#ff7f00'
set linetype 5 linewidth 2 pointtype 5 ps 1.0 linecolor rgb '#6a3d9a'
set linetype 6 linewidth 2 pointtype 9 ps 1.4 linecolor rgb '#a6cee3'
set linetype 7 linewidth 2 pointtype 7 ps 1.0 linecolor rgb '#b2df8a'
set linetype 8 linewidth 2 pointtype 5 ps 1.0 linecolor rgb '#fb9a99'
set linetype 9 linewidth 2 pointtype 9 ps 1.4 linecolor rgb '#fdbf6f'
set linetype 10 linewidth 2 pointtype 7 ps 1.0 linecolor rgb '#cab2d6'
unset linetype 11
unset linetype 12
unset linetype 13
unset linetype 14
unset linetype 15
unset linetype 16
unset linetype 17
unset linetype 18
unset linetype 19
unset linetype 20
set linetype cycle 10
# }}}
# Constants --------------------------------------------------------------- {{{
tau = 2 * pi
e = 2.71828182845905
r2 = sqrt(2.0)
# }}}
# Utility Functions ------------------------------------------------------- {{{
min(a, b) = (a<b) ? a : b
max(a, b) = (a>b) ? a : b
# }}}
# Exporting --------------------------------------------------------------- {{{
export(file, terminal) = sprintf( \
"set terminal push;" . \
"set terminal %s;" . \
"set output '%s';" . \
"replot;" . \
"set output;" . \
"set terminal pop;" . \
"print system('realpath %s | nnl | pbcopy');" \
, terminal, file, file)
export_pdf(file) = export(file . '.pdf', "pdfcairo")
export_png(file) = export(file . '.png', "pngcairo")
pdf = "eval export_pdf('graph')"
png = "eval export_png('graph')"
# }}}
# Other ------------------------------------------------------------------- {{{
kdens(file, column, bandwidth) = sprintf( \
"stats '%s' using %d;" . \
"plot '%s' using %d:(1.0/STATS_records) smooth kdensity bandwidth %f;" \
, file, column, file, column, bandwidth)
cdf(file, column) = sprintf( \
"plot '%s' using %d:(1.0) smooth cnormal;" \
, file, column)
# }}}