Skip to content

Instantly share code, notes, and snippets.

@YujiSODE
Last active September 12, 2023 04:15
Show Gist options
  • Save YujiSODE/8e15337659fb06b4647a3da992e1a3de to your computer and use it in GitHub Desktop.
Save YujiSODE/8e15337659fb06b4647a3da992e1a3de to your computer and use it in GitHub Desktop.
Sample result of error bar lengths in gnuplot.

Error bar length sample in a log scale

Sample result of error bar lengths in gnuplot.

error bar length = y*0.5
#Requirement
#
#G N U P L O T
# Version 5.2 patchlevel 8 last modified 2019-12-01
#
# Copyright (C) 1986-1993, 1998, 2004, 2007-2019
# Thomas Williams, Colin Kelley and many others
#============
#
#errorBars_logScale.gp
#
set grid;
#
set xrange [:110.0];
set yrange [:1.0e+10];
#
set logscale y 10;
set format y '10^{%L}';
#
set xlabel '{/Times:Italic=30 x}';
set ylabel '{/Times:Italic=30 y}';
#
set tics font 'Times,20';
set key font 'Times,20';
#
set key title '{/Times Error bar length = {/:Italic y}*0.5}';
set key right;
#---
#
#---
set tmargin at screen 0.95;
set lmargin at screen 0.25;
set rmargin at screen 0.95;
set bmargin at screen 0.20;
set ylabel offset -3.5,0.0;
#---
#
array X[10]=[10.0,20.0,30.0,40.0,50.0,60.0,70.0,80.0,90.0,100.0];
array Y[10]=[1.0e+0,1.0e+1,1.0e+2,1.0e+3,1.0e+4,1.0e+5,1.0e+6,1.0e+7,1.0e+8,1.0e+9];
#============
#
plot Y using (X[$1]):(Y[$1]) with lines notitle linecolor rgb '#0000ff',Y using (X[$1]):(Y[$1]):(Y[$1]*0.5) with yerrorbars notitle pointtype -1 linecolor rgb '#000000';
#
#============
#
#output: svg
#------------
set terminal svg size 600,600 background '#ffffff';
set output './errorBars_logScale.svg';
replot;
#------------
#
#output: png
#------------
set terminal png size 600,600;
set output './errorBars_logScale.png';
#
set xtics offset 0.0,-0.3;
#
replot;
#------------
#
#to reset terminal
set output;
#
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment